react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Gesture callback differences between platforms

Open elliotwaite opened this issue 3 years ago • 0 comments

Description

For certain gestures, the callbacks that are called, or the order in which they are called, differs between platforms. I listed the difference I've found below. The tables show the order of events from top to bottom.

Tap gesture (if pressed quickly):

iOS Android
onTouchesDown onBegin
onBegin onTouchesDown
onTouchesUp onTouchesUp
onStart onStart
onEnd onEnd
onFinalize onFinalize

Tap gesture (if pressed and held):

iOS Android
onTouchesDown onBegin
onBegin onTouchesDown
onTouchesCancelled onTouchesCancelled
onFinalize onFinalize
onFinalize (a second time)

LongPress gesture (if pressed quickly):

iOS Android
onTouchesDown onBegin
onBegin onTouchesDown
onTouchesUp onTouchesUp
onFinalize onFinalize

LongPress gesture (if pressed and held):

iOS Android
onTouchesDown onBegin
onBegin onTouchesDown
onStart onStart
onTouchesUp onTouchesUp
onEnd onEnd
onFinalize onFinalize

Fling gesture (when a fling is detected):

iOS Android
onBegin onBegin
onTouchesDown onTouchesDown
onTouchesMove (possibly multiple) onTouchesMove (possibly multiple)
onStart onStart
onEnd onTouchesCancelled
onFinalize onEnd
onTouchesCancelled onFinalize

Pinch gesture, Rotation gesture, and Native gesture (when pressed):

iOS Android
onBegin
onTouchesDown onTouchesDown
onTouchesUp onTouchesUp
onFinalize

Manual gesture (when pressed). In the provided Snack, this only happens on the first press because the gesture is never finalized:

iOS Android
onTouchesDown onBegin
onBegin onTouchesDown
onTouchesUp onTouchesUp

Steps to reproduce

  1. Open the provided Snack in two different windows and load one with iOS and one with Android.
  2. Click the gesture buttons on the left and view the log of the callbacks that were called on the right to observe the differences.
  3. You can clear the log by clicking the "Clear Log" button.

Snack or a link to a repository

https://snack.expo.dev/@elliotwaite/rngh-event-order-test

Gesture Handler version

2.5.0

React Native version

0.69.0

Platforms

Android, iOS

JavaScript runtime

No response

Workflow

No response

Architecture

No response

Build type

No response

Device

No response

Device model

No response

Acknowledgements

Yes

elliotwaite avatar Oct 07 '22 13:10 elliotwaite