diff options
author | dan <dan.abramov@gmail.com> | 2023-10-05 23:28:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-05 15:28:56 -0700 |
commit | 260b03a05c22232373cbf8cb0d7dda41a3302343 (patch) | |
tree | f7ce8b72c80fbdc723245dc34d1db56288b7b176 /src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx | |
parent | eb7306b16512e317f477c7a28e1e3b0ce5c65ff8 (diff) | |
download | voidsky-260b03a05c22232373cbf8cb0d7dda41a3302343.tar.zst |
Remove unused lightbox options (#1616)
* Inline lightbox helpers * Delete unused useImagePrefetch * Delete unused long press gesture * Always enable double tap * Always enable swipe to close * Remove unused onImageIndexChange * Inline custom Hooks into ImageViewing * Declare LightboxFooter outside Lightbox * Add more TODO comments * Inline useDoubleTapToZoom * Remove dead utils, move utils used only once
Diffstat (limited to 'src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx')
-rw-r--r-- | src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx index f5e858209..927657baf 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx @@ -36,23 +36,11 @@ type Props = { imageSrc: ImageSource onRequestClose: () => void onZoom: (isZoomed: boolean) => void - onLongPress: (image: ImageSource) => void - delayLongPress: number - swipeToCloseEnabled?: boolean - doubleTapToZoomEnabled?: boolean } const AnimatedImage = Animated.createAnimatedComponent(Image) -const ImageItem = ({ - imageSrc, - onZoom, - onRequestClose, - onLongPress, - delayLongPress, - swipeToCloseEnabled = true, - doubleTapToZoomEnabled = true, -}: Props) => { +const ImageItem = ({imageSrc, onZoom, onRequestClose}: Props) => { const imageContainer = useRef<ScrollView & NativeMethodsMixin>(null) const imageDimensions = useImageDimensions(imageSrc) const [translate, scale] = getImageTransform(imageDimensions, SCREEN) @@ -72,17 +60,10 @@ const ImageItem = ({ [onZoom], ) - const onLongPressHandler = useCallback(() => { - onLongPress(imageSrc) - }, [imageSrc, onLongPress]) - const [panHandlers, scaleValue, translateValue] = usePanResponder({ initialScale: scale || 1, initialTranslate: translate || {x: 0, y: 0}, onZoom: onZoomPerformed, - doubleTapToZoomEnabled, - onLongPress: onLongPressHandler, - delayLongPress, }) const imagesStyles = getImageStyles( @@ -126,11 +107,9 @@ const ImageItem = ({ showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false} contentContainerStyle={styles.imageScrollContainer} - scrollEnabled={swipeToCloseEnabled} - {...(swipeToCloseEnabled && { - onScroll, - onScrollEndDrag, - })}> + scrollEnabled={true} + onScroll={onScroll} + onScrollEndDrag={onScrollEndDrag}> <AnimatedImage {...panHandlers} source={imageSrc} |