Double tap to zoom gesture #2192
Unanswered
billjohnston
asked this question in
Q&A
Replies: 1 comment
-
For anyone coming from the future, pan gestures and tap gestures can be used in the following manner: const tap = Gesture.Tap()
.maxDuration(250)
.numberOfTaps(1);
const doubleTap = Gesture.Tap()
.maxDuration(250)
.numberOfTaps(2)
const pan = Gesture.Pan();
const composedGesture = Gesture.Race(pan, Gesture.Exclusive(doubleTap, tap)); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to create a double tap to zoom gesture similar to google maps. This zoom UI is nested in a scroll view and another pan gesture used for page navigation. This is the closest I've gotten (have been testing on IOS):
https://snack.expo.dev/@billjohnston1/double-tap-zoom
A single tap gesture and the pan gesture listening simultaneously. The first tap enables the pan gesture and disables the tap. The second tap will be the touchDown for the pan gesture. The setTimeout will disable the pan gesture again after 250ms so the parent scroll / pan gesture will be active again if there is no second tap.
This works pretty well BUT sometimes Its causing the app to freeze then crash. I'm thinking it has something to do with the setTimeout firing while the parent pan gesture is active (this is hard to debug though because I don't get any error messages)
I also tried a pan gesture with manual activation but even when its not active it prevents the parent scroll and pan gestures from firing. Setting the pan gesture to enabled(false) seems to be the only way the parent gestures still respond
Wondering if there is an easier / less crash prone method to do a double tap to zoom?
Beta Was this translation helpful? Give feedback.
All reactions