PanResponder.create()
has many callbacks and two of them are onPanResponderGrant
and onPanResponderStart
. Both callbacks getting triggered as soon as screen is touched.react-native
official documentation doesn't have much information about these callbacks.
Can anybody let me know the difference between these two callbacks and when to use which one?
onPanResponderGrant
is called when a gesture is "started" while onPanResponderStart
is called on additional gesture events.
For example, if you were to place one finger on the screen, onPanResponderGrant
would fire, then, if a second finger is placed without removing the first onPanResponderStart
would fire.
You can view some logic regarding this in the RN repo: https://github.com/facebook/react-native/blob/master/Libraries/Interaction/PanResponder.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With