From 5d0c3cfa62f7acbd9926dfa5a1ab8bb2ea49c127 Mon Sep 17 00:00:00 2001 From: alaoui abdellah Date: Wed, 2 Nov 2016 09:21:20 +0000 Subject: [PATCH] Add toggle drawer to the Readme Provide a short explanation on how to toggle the drawer, and provide a simple example. --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 52bfecb..0b50398 100644 --- a/README.md +++ b/README.md @@ -554,7 +554,27 @@ const styles = StyleSheet.create({ } }); ``` +#### Toggling the drawer +If you want to toggle the drawer from one of your components, make sure you have navigation in your props. Or else, add `@withNavigation` to your component. +```javascript +@withNavigation +class MenuButton extends React.Component { + constructor(props) { + super(props) + } + render() { + // main is the id given to DrawerNavigation + const navigator = this.props.navigation.getNavigator('main'); + return( + { navigator.toggleDrawer() }}> + Menu + + ) + + } +} +``` ### Integrate with your existing Redux store