Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lack of Docs:- Easy Example] Can someone please help me with side-menu (drawer)? #2291

Closed
themakerman opened this issue Aug 26, 2017 · 5 comments

Comments

@themakerman
Copy link

themakerman commented Aug 26, 2017

This is what my Router looks like now. I am really struggling with the docs. I have implemented my own toolbar using views which has hamburger icon. The toolbar is at mainscreen.
toolbar

Due to lack of Documentation i am really struggling to use navDrawer in my code. The app is in production so i feel very reluctant to make changes to the code as it can break it if i don't use it correctly. Debugging again will be a pain.

This is how my file with Router component looks like.

<Router getSceneStyle={() => ({ backgroundColor: 'transparent' })}>
                  <Scene key="root">
                    <Scene key="splash" component={SplashScreen} hideNavBar initial />
                    <Scene key="mainscreen" component={MainScreen} type="reset" hideNavBar />
                    <Scene key="settingsScreen" component={SettingsScreen} hideNavBar />
                  </Scene>
                </Router>

What should i do so that on my component={MainScreen} i can trigger the navDrawer on <TouchableOpacity onPress={ () => ?} />. Hamburger icon is nested inside TouchableOpacity component.

Would really be grateful if someone can help me out on this.

@themakerman themakerman changed the title Can someone please help me with side-menu (drawer)? [Lack of Docs:- Easy Example] Can someone please help me with side-menu (drawer)? Aug 26, 2017
@aksonov
Copy link
Owner

aksonov commented Aug 28, 2017

Have you tried Example project from this repo?

@mkayswork
Copy link

mkayswork commented Aug 29, 2017

@themakerman you could call the drawer via Actions.drawerOpen(). @aksonov within the example there is nothing about to read or see about the drawer.

@themakerman
Copy link
Author

@mkayswork Yes but i am more like confused towards defining the view itself. Where should i define it as a component? Should it be nested inside ....... ?

@mkayswork
Copy link

mkayswork commented Sep 1, 2017

You mean the view that should be displayed as drawer a.k.a. side menu? You could define a Scene which contains the drawer like so ( version 4 of this project, not version 3):

<Scene key='drawer' drawer contentComponent={YourSideMenu} hideNavBar> </Scene>

And within this tag you nest in the the views which should access the side menu. Let's assume you have a view which contains a button on the left side of the navBar:

<Scene key='sampleView' onLeft={() => this.openSideMenu()} leftButtonImage={require('your image source'}/>
Somewhere inside your component's class you have this function
openSideMenu() { Actions.drawerOpen() }

Hope this helps you.

@themakerman
Copy link
Author

@mkayswork Great. Thank you so much :). Gonna try it tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants