Always enable double tap
This commit is contained in:
@@ -37,7 +37,6 @@ type Props = {
|
||||
onRequestClose: () => void
|
||||
onZoom: (isZoomed: boolean) => void
|
||||
swipeToCloseEnabled?: boolean
|
||||
doubleTapToZoomEnabled?: boolean
|
||||
}
|
||||
|
||||
const AnimatedImage = Animated.createAnimatedComponent(Image)
|
||||
@@ -47,7 +46,6 @@ const ImageItem = ({
|
||||
onZoom,
|
||||
onRequestClose,
|
||||
swipeToCloseEnabled = true,
|
||||
doubleTapToZoomEnabled = true,
|
||||
}: Props) => {
|
||||
const imageContainer = useRef<ScrollView & NativeMethodsMixin>(null)
|
||||
const imageDimensions = useImageDimensions(imageSrc)
|
||||
@@ -72,7 +70,6 @@ const ImageItem = ({
|
||||
initialScale: scale || 1,
|
||||
initialTranslate: translate || {x: 0, y: 0},
|
||||
onZoom: onZoomPerformed,
|
||||
doubleTapToZoomEnabled,
|
||||
})
|
||||
|
||||
const imagesStyles = getImageStyles(
|
||||
|
||||
@@ -39,7 +39,6 @@ type Props = {
|
||||
onRequestClose: () => void
|
||||
onZoom: (scaled: boolean) => void
|
||||
swipeToCloseEnabled?: boolean
|
||||
doubleTapToZoomEnabled?: boolean
|
||||
}
|
||||
|
||||
const AnimatedImage = Animated.createAnimatedComponent(Image)
|
||||
@@ -49,7 +48,6 @@ const ImageItem = ({
|
||||
onZoom,
|
||||
onRequestClose,
|
||||
swipeToCloseEnabled = true,
|
||||
doubleTapToZoomEnabled = true,
|
||||
}: Props) => {
|
||||
const scrollViewRef = useRef<ScrollView>(null)
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
@@ -126,7 +124,7 @@ const ImageItem = ({
|
||||
})}>
|
||||
{(!loaded || !imageDimensions) && <ImageLoading />}
|
||||
<TouchableWithoutFeedback
|
||||
onPress={doubleTapToZoomEnabled ? handleDoubleTap : undefined}
|
||||
onPress={handleDoubleTap}
|
||||
accessibilityRole="image"
|
||||
accessibilityLabel={imageSrc.alt}
|
||||
accessibilityHint="">
|
||||
|
||||
@@ -9,7 +9,6 @@ type Props = {
|
||||
onRequestClose: () => void
|
||||
onZoom: (scaled: boolean) => void
|
||||
swipeToCloseEnabled?: boolean
|
||||
doubleTapToZoomEnabled?: boolean
|
||||
}
|
||||
|
||||
const ImageItem = (_props: Props) => {
|
||||
|
||||
@@ -38,14 +38,12 @@ type Props = {
|
||||
initialScale: number
|
||||
initialTranslate: Position
|
||||
onZoom: (isZoomed: boolean) => void
|
||||
doubleTapToZoomEnabled: boolean
|
||||
}
|
||||
|
||||
const usePanResponder = ({
|
||||
initialScale,
|
||||
initialTranslate,
|
||||
onZoom,
|
||||
doubleTapToZoomEnabled,
|
||||
}: Props): Readonly<
|
||||
[GestureResponderHandlers, Animated.Value, Animated.ValueXY]
|
||||
> => {
|
||||
@@ -181,7 +179,7 @@ const usePanResponder = ({
|
||||
lastTapTS && tapTS - lastTapTS < DOUBLE_TAP_DELAY,
|
||||
)
|
||||
|
||||
if (doubleTapToZoomEnabled && isDoubleTapPerformed) {
|
||||
if (isDoubleTapPerformed) {
|
||||
let nextScale = initialScale
|
||||
let nextTranslate = initialTranslate
|
||||
|
||||
@@ -229,7 +227,7 @@ const usePanResponder = ({
|
||||
gestureState: PanResponderGestureState,
|
||||
) => {
|
||||
// Don't need to handle move because double tap in progress (was handled in onStart)
|
||||
if (doubleTapToZoomEnabled && isDoubleTapPerformed) {
|
||||
if (isDoubleTapPerformed) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ type Props = {
|
||||
animationType?: ModalProps['animationType']
|
||||
backgroundColor?: string
|
||||
swipeToCloseEnabled?: boolean
|
||||
doubleTapToZoomEnabled?: boolean
|
||||
HeaderComponent?: ComponentType<{imageIndex: number}>
|
||||
FooterComponent?: ComponentType<{imageIndex: number}>
|
||||
}
|
||||
@@ -64,7 +63,6 @@ function ImageViewing({
|
||||
onImageIndexChange,
|
||||
backgroundColor = DEFAULT_BG_COLOR,
|
||||
swipeToCloseEnabled,
|
||||
doubleTapToZoomEnabled,
|
||||
HeaderComponent,
|
||||
FooterComponent,
|
||||
}: Props) {
|
||||
@@ -144,7 +142,6 @@ function ImageViewing({
|
||||
imageSrc={imageSrc}
|
||||
onRequestClose={onRequestCloseEnhanced}
|
||||
swipeToCloseEnabled={swipeToCloseEnabled}
|
||||
doubleTapToZoomEnabled={doubleTapToZoomEnabled}
|
||||
/>
|
||||
)}
|
||||
onMomentumScrollEnd={onScroll}
|
||||
|
||||
Reference in New Issue
Block a user