Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Add toggle drawer to the Readme #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<TouchableOpacity onPress={()=>{ navigator.toggleDrawer() }}>
<Text>Menu</Text>
</TouchableOpacity>
)

}
}
```

### Integrate with your existing Redux store

Expand Down