Stop PanResponder during move gesture
See original GitHub issueTL;DR
I want to stop the PanResponder
system while it’s still moving (within onPanResponderMove
callback).
Explanation
I’ve created a basic code where pan responder is used to drag an element around. Now I want the pan responder to stop the event, and trigger some other animation, if a certain condition has been met while dragging.
I use the following code:
let panMover = Animated.event([null,{
dy : this.state.animatedY,
}]);
this.panResponder = PanResponder.create({
onPanResponderTerminationRequest: () => false,
onStartShouldSetPanResponder : () => true,
onPanResponderMove: (e, gesture) => {
if( /* certain condition has been met */ ) {
// 1. stop the pan responder
// 2. start some other animation
return false;
}
return panMover(e, gesture);
},
onPanResponderRelease : (e, gesture) => true,
});
Returning false
momentarily stops the responder and creates a jittery effect when paired with some new animation. I want to completely terminate the responder. I’m looking for some API like panResponder.terminate();
Any help would be appreciated.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React Native Stop Pan Gesture during Move - Stack Overflow
You can stop a PanReponder system by enabling the PanResponder on the parent view. From the documentation, we have:.
Read more >PanResponder - React Native
PanResponder reconciles several touches into a single gesture. It makes single-touch gestures resilient to extra touches, and can be used to ...
Read more >[Solved]-React Native Stop Pan Gesture during Move-Reactjs
You can stop a PanReponder system by enabling the PanResponder on the parent view. From the documentation, we have: onStartShouldSetResponder and ...
Read more >How to handle user gestures in React Native with ... - Bam Tech
In this article I will explain how I developed a calendar handling pan gestures using React Native's PanResponder, and what I learnt through...
Read more >[2] The Pan Responder — React Native Animations (8 mins)
Pan Responder is not the most performant gesture handling library, ... At the end of Drag 2, similar to step [3], valueX/Y represents...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
Same question. Up 😃