react-native-drawer-layout
react-native-drawer-layout copied to clipboard
Disable Swipe Gesture to Open
Perhaps I am overlooking a very obvious piece of documentation but I cannot figure out how to disable the swipe gesture. I have looked within this project and DrawerLayoutAndroid. I only want users to be able to open the drawer via a button. Is this possible?
Thank you for your effort on this project.
Hey @JakielaAdam Unfortunately not, this project aimed to be a Polyfill for the DrawerLayoutAndroid
, which doesn't have such a functionality. We decoupled the react-native-drawer-layout-polyfill
to be able to do such changes.
I would love to see a PR from you, the main part you would need to change is the _shouldSetPanResponder
function. It controls if the user should be able to drag now. Adding a new prop like disableGuesture
here and return false early should have the behavior you are searching for.
Hi @DanielMSchmidt Thanks for the response. I will consider the PR soon when I have more time.
Setting drawerLockMode
to 'locked-closed'
enables you to disable the "swipe to open" gesture.
You can still close the menu by swiping - but if that's not a concern for you, then you can use drawerLockMode
.