Skip to content

Open Drawer from the navigation bar #382

@haikov

Description

@haikov

Hey, thank you for the amazing library!

I'm trying to implement navigation with drawer by root-two and I faced the problem. Is it possible to open drawer by clicking at the left button on the navigation bar? Here's my current code:

Inside index.ios.js I have

...
renderLeftButton() {
   // is it possible to open drawer here
   return (
       <TouchableOpacity onPress={() => this.context.drawer.open()} style={{height: 20, width: 20, backgroundColor: 'black'}}/>
    )
}
...
<Router createReducer={reducerCreate}>
    <Scene key="modal"  hideNavBar={true}>
        <Scene key="drawer" component={Drawer}>
            <Scene key="container" renderLeftButton={this.renderLeftButton.bind(this)}>
                <Scene key="dashboard" type="replace" component={Dashboard}/>
                <Scene key="articles" type="replace" component={Articles}/>
            </Scene>
        </Scene>
    </Scene>
</Router>
...

Or maybe I'm doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions