Skip to content

Instantly share code, notes, and snippets.

View dliff's full-sized avatar

Daniel Lifflander dliff

View GitHub Profile
@dliff
dliff / gist:159a3f6350e6865665892ade36376417
Created July 4, 2019 00:25
Setting React Navigation (React Native) drawerLockMode to `locked-closed` only when drawer is closed. (Don't allow open gesture, only close gesture).
Add Redux action setDrawerOpen to set a boolean Redux variable (drawerOpen).
In your contentComponent update the Redux store when drawer open/close is detected:
componentDidUpdate(prevProps) {
if (
prevProps.navigation.state.isDrawerOpen !=
this.props.navigation.state.isDrawerOpen
) {
this.props.setDrawerOpen(this.props.navigation.state.isDrawerOpen);
}