question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop PanResponder during move gesture

See original GitHub issue

TL;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:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

21reactions
hramoscommented, Jul 21, 2017

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

2reactions
avkvakcommented, Mar 14, 2017

Same question. Up 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found