Moussawi7 Moussawi7 - 1 month ago 14
Android Question

React Native :Disable Android Drawer

I am using DrawerLayout as a part of my project, but i don't want to give the user the ability to open the drawer in some pages, and I cannot find an option to disable it.
any trick with that?.

this is a portion of my code:

return (
<DrawerLayout
drawerWidth={300}
ref="drawer"
renderNavigationView={() => navigationView}>
<Router hideNavBar={true}>
<Schema name="default" sceneConfig={Navigator.SceneConfigs.FloatFromRight}/>
<Route initial={true} name="empty" component={Empty}/>
<Route name="login" component={Login} onLoginSuccess={()=>{this.onLoginSuccess()}}/>
<Route name="pages">
<Router footer={Footer} header={Header} hideNavBar={true}>
<Route name="issues" initial={true} component={Issues} title={"123"}/>
<Route name="analytics" component={Analytics} title={"456"}/>
</Router>
</Route>
</Router>
</DrawerLayout>
);

Answer

There is a new prop drawerLockMode in 0.22.0-rc that allows to lock the drawer.

http://facebook.github.io/react-native/releases/0.22/docs/drawerlayoutandroid.html#drawerlockmode

Comments