Fix bug in lightbox rendering (#133)
This commit is contained in:
@@ -86,12 +86,18 @@ function ImageViewing({
|
||||
[toggleBarsVisible],
|
||||
)
|
||||
|
||||
const onLayout = useCallback(() => {
|
||||
if (imageIndex) {
|
||||
imageList.current?.scrollToIndex({index: imageIndex, animated: false})
|
||||
}
|
||||
}, [imageList, imageIndex])
|
||||
|
||||
if (!visible) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.screen}>
|
||||
<View style={styles.screen} onLayout={onLayout}>
|
||||
<Modal />
|
||||
<View style={[styles.container, {opacity, backgroundColor}]}>
|
||||
<Animated.View style={[styles.header, {transform: headerTransform}]}>
|
||||
@@ -110,7 +116,6 @@ function ImageViewing({
|
||||
pagingEnabled
|
||||
showsHorizontalScrollIndicator={false}
|
||||
showsVerticalScrollIndicator={false}
|
||||
initialScrollIndex={imageIndex}
|
||||
getItem={(_, index) => images[index]}
|
||||
getItemCount={() => images.length}
|
||||
getItemLayout={(_, index) => ({
|
||||
|
||||
Reference in New Issue
Block a user