fix prefetching lightbox images (#1163)

* fix prefetching lightbox images

* use array signature

* fix other RN native image usage

* delay prefetching to allow UI to re-render
This commit is contained in:
Eric Bailey 2023-08-15 14:53:03 -05:00 committed by GitHub
parent 77178844fd
commit 331c506728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View file

@ -17,6 +17,7 @@ import {
NativeSyntheticEvent,
NativeMethodsMixin,
} from 'react-native'
import {Image} from 'expo-image'
import useImageDimensions from '../../hooks/useImageDimensions'
import usePanResponder from '../../hooks/usePanResponder'
@ -41,6 +42,8 @@ type Props = {
doubleTapToZoomEnabled?: boolean
}
const AnimatedImage = Animated.createAnimatedComponent(Image)
const ImageItem = ({
imageSrc,
onZoom,
@ -128,7 +131,7 @@ const ImageItem = ({
onScroll,
onScrollEndDrag,
})}>
<Animated.Image
<AnimatedImage
{...panHandlers}
source={imageSrc}
style={imageStylesWithOpacity}

View file

@ -18,6 +18,7 @@ import {
NativeSyntheticEvent,
TouchableWithoutFeedback,
} from 'react-native'
import {Image} from 'expo-image'
import useDoubleTapToZoom from '../../hooks/useDoubleTapToZoom'
import useImageDimensions from '../../hooks/useImageDimensions'
@ -42,6 +43,8 @@ type Props = {
doubleTapToZoomEnabled?: boolean
}
const AnimatedImage = Animated.createAnimatedComponent(Image)
const ImageItem = ({
imageSrc,
onZoom,
@ -131,7 +134,7 @@ const ImageItem = ({
accessibilityRole="image"
accessibilityLabel={imageSrc.alt}
accessibilityHint="">
<Animated.Image
<AnimatedImage
source={imageSrc}
style={imageStylesWithOpacity}
onLoad={() => setLoaded(true)}