react-native-router-flux v4
A way to open the drawer from within a scene
Only the navbar button opens the drawer
This is my Router
<Scene key="root" titleStyle={{}} hideNavBar>
<Scene key="auth">
<Scene key="login" component={Login} title={ I18n.t('loginTitle') }/>
</Scene>
<Scene key="drawer" drawer contentComponent={SideMenu} initial drawerPosition="right" drawerWidth={200} drawerLabel="Hi">
<Scene key="main">
<Scene key="menu" component={Menu} title={ I18n.t('menuTitle') }/>
<Scene key="orders" component={Orders} title={ I18n.t('ordersTitle') }/>
</Scene>
</Scene>
</Scene>
I need a custom button within the Menu scene to open the drawer.
I tried:
Actions.refresh({key: "drawer", open: true})
But that does not work since the new DrawerNavigatior does not have "open" as a config option. Docs say the way to open is:
this.props.navigation.navigate('DrawerOpen');
Not sure how to call that?
Try Actions.drawerOpen()
Just Add in root scene a prop drawer={true}
Can anyone tell me how to customize the drawer which is added in root scene
??
@Tanumay92
You can define your own component for the drawer
<Drawer key="app" contentComponent={DrawerContent} drawerWidth={300} >
Can you explain a Bit @sujayjaju
@Tanumay92 read the doc :
contentComponent | React.Component | 聽 | Component used to render the content of the drawer (e.g. navigation items).
-- | -- | -- | --
@aksonov it work for me
Worked also for me, good job :)
I'm currently facing this problem. Because I have 2 drawers, Actions.drawerOpen() will only open the root drawer. I need to be able to open a specific drawer.
Most helpful comment
Try
Actions.drawerOpen()