-
-
Save kennethhutw/17b89bd43465a1f81b7a8eebf5889407 to your computer and use it in GitHub Desktop.
Left and Right Drawers with React Navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
import { DrawerNavigator } from 'react-navigation'; | |
const ContentScreen = ({ navigation }) => ( | |
<Text>Content Hello World</Text> | |
); | |
const LeftDrawerScreen = ({ navigation }) => ( | |
<Text>Left Drawer</Text> | |
); | |
const RightDrawerScreen = ({ navigation }) => ( | |
<Text>Right Drawer</Text> | |
); | |
const ContentNavigator = DrawerNavigator({ | |
Content: { | |
screen: ContentScreen, | |
} | |
}, { | |
contentComponent: RightDrawerScreen, | |
drawerPosition: 'right' | |
}); | |
const RootNavigator = DrawerNavigator({ | |
Child: { | |
screen: ContentNavigator, | |
} | |
}, { | |
contentComponent: LeftDrawerScreen | |
}); | |
export default class App extends Component { | |
render() { | |
return (<RootNavigator />); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment