Fix bug in lightbox rendering (#133)

This commit is contained in:
Paul Frazee
2023-02-01 13:20:43 -06:00
committed by GitHub
parent 1e5330931d
commit 865deb930b
+7 -2
View File
@@ -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) => ({