Reputation: 1667
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?
Upvotes: 7
Views: 1840
Reputation: 442
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
Upvotes: 3