wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

Drawer swipe gesture steals all events from PanResponder > 10px delta #2352

Closed benogle closed 5 years ago

benogle commented 6 years ago

Issue Description

onPanResponderMove only called for 10px or so (the slop threshold, I assume), then the drawer gesture takes over. No other PanResponder lifecycle events are called after it takes over.

screen shot 2017-12-14 at 6 12 08 pm

Disabling the drawer gesture with disableOpenGesture fixes this. But we'd like to keep the drawer gesture.

Steps to Reproduce / Code Snippets / Screenshots

Create a single page app with a drawer and the swipe gesture enabled. Create a component with this pan responder in the root component:

this._panResponder = PanResponder.create({
  onStartShouldSetPanResponder: () => true,
  onStartShouldSetPanResponderCapture: () => true,

  onMoveShouldSetPanResponder: () => true,
  onMoveShouldSetPanResponderCapture: () => true,

  onPanResponderMove: (e, gestureState) => {
    console.log('onPanResponderMove', gestureState.dx, gestureState.dy)
  },
  onPanResponderGrant: (evt, gestureState) => {
    console.info('onPanResponderGrant')
  },
  onPanResponderReject: evt => {
    console.info('onPanResponderReject')
  },
  onPanResponderTerminationRequest: () => {
    console.log('onPanResponderTerminationRequest')
    return false
  },
  onShouldBlockNativeResponder: () => true,
})

Try to swipe down on your component.


Environment

ahoseinian commented 6 years ago

I am having the same problem on ios without using the drawer at all, is there any fix for it?

PimDeWitte commented 6 years ago

Having the same issue. disabling the drawer on the grant also doesn't work. There has to be a way where disabling the drawer via the disable/enable method will remove this call?

akmjenkins commented 6 years ago

@PimDeWitte - did you try my PR? It has to do with the native gesture always being enabled after a drawer has been enabled the first time.

AndrePech commented 6 years ago

Having the same issue, I am trying to use a Swipable List item, does not work even if the swipe gesture is opposite to the drawer direction.

isaachinman commented 6 years ago

Is there any solution for this? Copy/pasting the official PanResponderExample into a react-native-navigation project will demonstrate the issue here.

As @PimDeWitte mentioned, disabling the drawer does not make a difference.

Update: for now, this issue can be avoided by using disableOpenGesture: false. Of course at the moment this means foregoing gesture opening across your entire app, as this is a config option and can't be changed on the fly.

I would suggest, as the fix to this issue, to simply replicate whatever is happening behind the scenes of disableOpenGesture: false, when setDrawerEnabled({ enabled: false }) is called.

akmjenkins commented 6 years ago

@isaachinman Please see the open PR #2578. It's a trivial fix. The native iOS gestureresponder simply needs to be removed from the drawer when it's disabled (and [re]added when the drawer is enabled).

isaachinman commented 6 years ago

@akmjenkins Yes, I saw that. However, I'm wary of depending on a fork for such a core requirement.

I see that #2578 has been open for almost three months now. Who has write access to this repo?

collinglass commented 6 years ago

Is there any way to get the pan responder to fire the onPanResponderTerminate event, signalling that the drawer has taken over the responder events? This is the behaviour I would expect.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

benogle commented 6 years ago

Still an issue

ujwal-setlur commented 6 years ago

This is an issue on v2 as well. I am using a swipable list view, and on iOS, the swipe stops after 10 pixels or so, even on the opposite side of the drawer. Works on android. Where would I specify disableOpenGesture: false?

ujwal-setlur commented 6 years ago

I tried PR #2578 on the v2 code base, and it didn't help...

ujwal-setlur commented 6 years ago

I tried PR #2578 on the v2 code base, and it didn't help...

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

benogle commented 6 years ago

Still an issue

ujwal-setlur commented 6 years ago

I use react-native-gesture-handler now with its swipeable component, and it works. Using RNN v2.

ujwal-setlur commented 6 years ago

Otherwise check out PR #3753

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

benogle commented 6 years ago

Still an issue

peterleilei86 commented 6 years ago

Any update?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

guyca commented 5 years ago

This should be resolve by #4348 using

{
  sideMenu: {
    openGestureMode: 'bezel'
  }
}