reset
This commit is contained in:
@@ -156,7 +156,6 @@ const ImageItem = ({
|
||||
delayLongPress,
|
||||
swipeToCloseEnabled = true,
|
||||
doubleTapToZoomEnabled = true,
|
||||
gestureRef,
|
||||
}: Props) => {
|
||||
const [isScaled, setIsScaled] = useState(false)
|
||||
const [isLoaded, setIsLoaded] = useState(false)
|
||||
@@ -224,7 +223,6 @@ const ImageItem = ({
|
||||
}
|
||||
|
||||
const pinch = Gesture.Pinch()
|
||||
.withRef(gestureRef)
|
||||
.onStart((e) => {
|
||||
pinchOrigin.value = {
|
||||
x: e.focalX - SCREEN.width/2,
|
||||
@@ -267,7 +265,6 @@ const ImageItem = ({
|
||||
|
||||
const pan = Gesture.Pan()
|
||||
.averageTouches(true)
|
||||
.enabled(isScaled)
|
||||
.onChange((e) => {
|
||||
if (!imageDimensions) {
|
||||
return;
|
||||
|
||||
@@ -112,13 +112,6 @@ function ImageViewing({
|
||||
return null
|
||||
}
|
||||
|
||||
const [gestureRefs] = useState(new Map())
|
||||
for (let imageSrc of images) {
|
||||
if (!gestureRefs.get(imageSrc)) {
|
||||
gestureRefs.set(imageSrc, createRef())
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<SafeAreaView
|
||||
style={styles.screen}
|
||||
@@ -137,47 +130,14 @@ function ImageViewing({
|
||||
<ImageDefaultHeader onRequestClose={onRequestCloseEnhanced} />
|
||||
)}
|
||||
</Animated.View>
|
||||
<VirtualizedList
|
||||
ref={imageList}
|
||||
data={images}
|
||||
horizontal
|
||||
pagingEnabled
|
||||
showsHorizontalScrollIndicator={false}
|
||||
showsVerticalScrollIndicator={false}
|
||||
getItem={(_, index) => images[index]}
|
||||
getItemCount={() => images.length}
|
||||
getItemLayout={(_, index) => ({
|
||||
length: SCREEN_WIDTH,
|
||||
offset: SCREEN_WIDTH * index,
|
||||
index,
|
||||
})}
|
||||
renderItem={({item: imageSrc}) => (
|
||||
<ImageItem
|
||||
onZoom={onZoom}
|
||||
imageSrc={imageSrc}
|
||||
onRequestClose={onRequestCloseEnhanced}
|
||||
onLongPress={onLongPress}
|
||||
delayLongPress={delayLongPress}
|
||||
swipeToCloseEnabled={swipeToCloseEnabled}
|
||||
doubleTapToZoomEnabled={doubleTapToZoomEnabled}
|
||||
gestureRef={gestureRefs.get(imageSrc)}
|
||||
/>
|
||||
)}
|
||||
renderScrollComponent={props => (
|
||||
<ScrollView
|
||||
{...props}
|
||||
waitFor={Array.from(gestureRefs.values())}
|
||||
/>
|
||||
)}
|
||||
onMomentumScrollEnd={onScroll}
|
||||
//@ts-ignore
|
||||
keyExtractor={(imageSrc, index) =>
|
||||
keyExtractor
|
||||
? keyExtractor(imageSrc, index)
|
||||
: typeof imageSrc === 'number'
|
||||
? `${imageSrc}`
|
||||
: imageSrc.uri
|
||||
}
|
||||
<ImageItem
|
||||
onZoom={onZoom}
|
||||
imageSrc={images[0]}
|
||||
onRequestClose={onRequestCloseEnhanced}
|
||||
onLongPress={onLongPress}
|
||||
delayLongPress={delayLongPress}
|
||||
swipeToCloseEnabled={swipeToCloseEnabled}
|
||||
doubleTapToZoomEnabled={doubleTapToZoomEnabled}
|
||||
/>
|
||||
{typeof FooterComponent !== 'undefined' && (
|
||||
<Animated.View style={[styles.footer, {transform: footerTransform}]}>
|
||||
|
||||
Reference in New Issue
Block a user