-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Touchable] How to stopPropagation touch event #1046
Comments
Having the same issue. I'm wondering if ShouldCapture events should return true if the movement is more horizontal than vertical. The documents are not great for the PanResponder API. |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
componentWillMount: function() {
this.gesture = PanResponder.create({ ... });
}
render: function() {
return (
<View {...this.gesture.panHandlers} ... />
);
},
Can you be more specific about what you are trying to do? Maybe post a minimal example of the issue on rnplay.org? If you have any improvements to the gesture guide or the pan responder docs, feel free to make a pull request! |
@ericvicenti - I've had this issue myself as well - for example: Inside of the horizontal ScrollView, at the bottom of each page there is a footer that can be pulled upwards. If you start pulling this up ( The best solution would be to just be able to have the PanResponder become responder and block ScrollView. @vjeux mentioned that on Android there is a ~5px delay when the gesture starts before the ScrollView takes over, which gives the PanResponder a chance to respond. Maybe a similar solution is needed for iOS. |
While trying to move a componentWillMount: function() {
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => true,
onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
onMoveShouldSetPanResponder: (evt, gestureState) => true,
onMoveShouldSetPanResponderCapture: (evt, gestureState) => true
});
} <SliderIOS {...this._panResponder.panHandlers} /> Even though I use react-native/Libraries/CustomComponents/Navigator/Navigator.js Lines 612 to 614 in b9c5f75
|
I had the same problem. This response solved it for me. Essentially same as @tukkajukka's solution above, only with componentWillMount () {
this._panResponder = PanResponder.create({
onPanResponderTerminationRequest: () => false,
onStartShouldSetPanResponderCapture: () => true,
});
} |
I also want to do same thing(Stop Panresponder after a given event).Please Help |
+1 |
1 similar comment
+1 |
+1 |
+1 |
Ideally, once something gets the responder, it can prevent others from responding by setting However, we often have troubles while interacting with touch interactions happening on the main thread, like the iOS slider, or any scroll views. The problem is that javascript cannot immediately reject the responsiveness of the native event, because the main thread must synchronously decide if JS or the scroll view should become responder, and JS can only respond asynchronously. This is a difficult problem to solve, and is something we have been thinking about for a while. cc @vjeux @sahrens @jordwalke @lelandrichardson. This could be solved in a similar way as @kmagiera is moving animations to the UI thread. Basically we construct and serialize some logic such that these immediate operations can be resolved without waiting for the JS thread. |
A workaround for now could be to disable ScrollView onPanResponderGrant then enable onPanResponderRelease |
+1 We tried disabling the ScrollView onPanResponderGrant, but if you pan the View (children) too fast, the pan propagates to the ScrollView before the block, so it moves with it. |
For everyone having this issue, you can try our current hack (https://github.com/mjracca/react-native-scroll-block). Blocking the We also added a Hope it helps! |
Hi , |
+1 |
+1 |
Disables Tap Events. |
+1 |
This is an extremely difficult issue to fix, so I've moved it to product pains, so the community can prioritize it properly for the RN team. If this issue is still important to you, please upvote it here on product pains! https://productpains.com/post/react-native/improved-scrollview-touch-interactions |
I use
It works much faster than setting state variable and there is no scroll movement even if you swipe fast. |
@nulleof that may not work well on Android. |
I'm currently disabling scrolling in |
I managed to figure out a solution to my problem above with this:
It works but its not perfect. When you swipe and scroll in quick succession, scroll isn't disabled fast enough. |
I have an issue with a Picker on top of a View with PanResponder. The view catches my swipes on the picker. Any idea how to solve this? |
|
Super hard to get scroll / pan + move working 100% but this is pretty close. Downside is that scroll is disabled on ScrollView. This discussion may help: facebook/react-native#1046
Super hard to get scroll / pan + move working 100% but this is pretty close. Downside is that scroll is disabled on ScrollView. This discussion may help: facebook/react-native#1046
Is this closed/solved? What is the best solution so far? I've tried the setNativeProps solution but it is not fast enough. If you drag fast the native will respond before and drag a little. |
Hey @ericvicenti, I added the comment above and it's showing that I unassigned you from this issue. I have no idea why that is showing. I think I don't even have the permissions to do such thing. |
+1 same issue |
I have a ScrollView which contains a View inside.
When I move touch on the View, It will scroll the ScrollView too.
I woner is there a way to stopPropagation just like the DOM event does.
I have tried to set PanResponder like this,but It didn`t work
The text was updated successfully, but these errors were encountered: