react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[V2] No way to disable open/close gestures for drawer

Open terreb opened this issue 8 years ago • 11 comments

Issue Description

Currently as I understand there is no way to disable open/close gestures for the drawer. This functionality is required when there is horizontally swiping UI elements (lists with swipe rows for example), otherwise it interferes and make them unusable.

Steps to Reproduce / Code Snippets / Screenshots

Nothing to reproduce the functionality is just missing.


Environment

  • React Native Navigation version: 2.0.2485
  • React Native version: 0.56.0
  • Platform(s) (iOS, Android, or both?): both
  • Device info (Simulator/Device? OS version? Debug/Release?): any

terreb avatar Aug 23 '18 09:08 terreb

I think I found a workaround. It can be completely disabled when not visible:

    Navigation.mergeOptions('sideDrawer', {
        sideMenu: {
            right: {
                visible: false,
                enabled: false,
            }
        }
    })

Still I feel like this is kind of a hack rather than a solution. Also, I have another issue with this workaround: https://github.com/wix/react-native-navigation/issues/3837.

terreb avatar Aug 23 '18 10:08 terreb

The Android SideMenuOptions don’t seem to include an enabled flag: https://github.com/wix/react-native-navigation/blob/v2/lib/android/app/src/main/java/com/reactnativenavigation/parse/SideMenuOptions.java

Are you sure this is working?

haggholm avatar Sep 21 '18 23:09 haggholm

+1 to this issue - I don't find that the sideMenu enabled has any effect in android and there for can not disable the drawer from gestures.

reganperkins avatar Sep 25 '18 01:09 reganperkins

@haggholm did you try with the version 2.0.2485 and with the exact code I mentioned above (using mergeOptions?). Also that way it worked only on iOS (I'm mentioning this in the issue I referenced above #3837). On Android neither way worked for me.

terreb avatar Sep 26 '18 07:09 terreb

@guyca, is there currently a way / workaround to disable open/close gestures for drawer that would work on both platforms? Thank you for letting us know.

terreb avatar Sep 26 '18 12:09 terreb

@terreb I don’t really work with iOS, so no, I only tried Android. In Android, the option doesn’t even seem to be an option.

haggholm avatar Sep 26 '18 17:09 haggholm

To disable swipe gesture or open /close the drawer programmatically, I set enabled to false as default option, and just toggle the visible property on button click

// button onClick function:

    Navigation.mergeOptions('sideDrawer', {
        sideMenu: {
            right: {
                visible: false/true,
            }
        }
    })

laukaichung avatar Nov 30 '18 05:11 laukaichung

I tried this and works for Android only. In ios, the swiperow gets stuck. v2.1.3 https://github.com/wix/react-native-navigation/issues/3575

thalesgaldino avatar Dec 12 '18 16:12 thalesgaldino

I think I found a workaround. It can be completely disabled when not visible:

    Navigation.mergeOptions('sideDrawer', {
        sideMenu: {
            right: {
                visible: false,
                enabled: false,
            }
        }
    })

Still I feel like this is kind of a hack rather than a solution. Also, I have another issue with this workaround: #3837.

@terreb yep, it works when it's not visible. But, how to turn it off when it's visible? :) popGesture: false didn't work for me :/

fmorau avatar Mar 19 '19 09:03 fmorau

@chelovekdrakon, sorry I don't know how to disable gestures when it's open. For the project I was working on disabling it when not visible was enough. Try stackoverflow maybe.

terreb avatar Mar 19 '19 10:03 terreb

@chelovekdrakon, sorry I don't know how to disable gestures when it's open. For the project I was working on disabling it when not visible was enough. Try stackoverflow maybe.

Ten four :) Thank you for the reply anyway!

fmorau avatar Mar 19 '19 12:03 fmorau