React-native-router-flux: How to open Drawer using a custom event / action within a screen

Created on 18 Aug 2017  路  9Comments  路  Source: aksonov/react-native-router-flux

Version

react-native-router-flux v4

Expected behaviour

A way to open the drawer from within a scene

Actual behaviour

Only the navbar button opens the drawer

Steps to reproduce

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?

Most helpful comment

Try Actions.drawerOpen()

All 9 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sreejithr picture sreejithr  路  3Comments

wootwoot1234 picture wootwoot1234  路  3Comments

xnog picture xnog  路  3Comments

kirankalyan5 picture kirankalyan5  路  3Comments

fgrs picture fgrs  路  3Comments