Toggle lightbox controls on tap (#1687)

* Make the lightbox controls animation smoother

* Toggle controls on tap

* Disable pointer events when hidden
This commit is contained in:
dan
2023-10-13 20:10:27 +01:00
committed by GitHub
parent f447eaa669
commit abfd9a8c0b
4 changed files with 81 additions and 63 deletions
@@ -34,11 +34,13 @@ const initialTransform = createTransform()
type Props = {
imageSrc: ImageSource
onRequestClose: () => void
onTap: () => void
onZoom: (isZoomed: boolean) => void
isScrollViewBeingDragged: boolean
}
const ImageItem = ({
imageSrc,
onTap,
onZoom,
onRequestClose,
isScrollViewBeingDragged,
@@ -227,6 +229,10 @@ const ImageItem = ({
panTranslation.value = {x: 0, y: 0}
})
const singleTap = Gesture.Tap().onEnd(() => {
runOnJS(onTap)()
})
const doubleTap = Gesture.Tap()
.numberOfTaps(2)
.onEnd(e => {
@@ -297,6 +303,7 @@ const ImageItem = ({
dismissSwipePan,
Gesture.Simultaneous(pinch, pan),
doubleTap,
singleTap,
)
const isLoading = !isLoaded || !imageDimensions