Skip to content

Instantly share code, notes, and snippets.

Created August 27, 2017 16:51
Show Gist options
  • Save anonymous/4d2fda0e9de87ef73187283f797ed1ec to your computer and use it in GitHub Desktop.
Save anonymous/4d2fda0e9de87ef73187283f797ed1ec to your computer and use it in GitHub Desktop.
export default class DrawerContainer extends Component {
render() {
return (
<DrawerLayout
ref={drawerLayout => (this.drawer = drawerLayout)}
drawerWidth={300}
drawerPosition={DrawerLayout.positions.Left}
//this renders the content of the slide out drawer
renderNavigationView={() =>
<Home {...this.props} drawer={this.drawer} />}
>
//This is the Home screen which contains the drawer open button
<Home {...this.props} drawer={this.drawer} />
</DrawerLayout>
)
}
}
export default class Home extends Component {
render() {
return (
<View style={styles.menu}>
<TeamMenu {...this.props} />
</View>
)
}
}
export default class Home extends Component {
render() {
return (
<DrawerButton size={35} {...props} />
)
}
}
export default class DrawerButton extends Component {
render() {
return (
<TouchableOpacity
onPress={() => props.drawer.openDrawer()}
>
<Icon name="md-menu" size={props.size} />
</TouchableOpacity>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment