Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Disable Swipe Gesture to Open #49

Open
JakielaAdam opened this issue Dec 11, 2017 · 3 comments
Open

Disable Swipe Gesture to Open #49

JakielaAdam opened this issue Dec 11, 2017 · 3 comments

Comments

@JakielaAdam
Copy link

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.

@DanielMSchmidt
Copy link
Collaborator

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.

@JakielaAdam
Copy link
Author

Hi @DanielMSchmidt Thanks for the response. I will consider the PR soon when I have more time.

@louiszawadzki
Copy link

louiszawadzki commented Jan 23, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants