Created
May 29, 2018 00:10
-
-
Save kyo504/26a0e6978378a22e8e507da2827da681 to your computer and use it in GitHub Desktop.
shallow-navigation-options
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 from 'react'; | |
import { StyleSheet, Text, View } from 'react-native'; | |
import { createStackNavigator, createBottomTabNavigator } from 'react-navigation'; | |
const HomeScreen = () => ( | |
<View style={styles.container}> | |
<Text>HomeScreen</Text> | |
</View> | |
); | |
const SettingsScreen = () => ( | |
<View style={styles.container}> | |
<Text>SettingsScreen</Text> | |
</View> | |
); | |
const HomeStack = createStackNavigator({ Home: HomeScreen }); | |
HomeStack.navigationOptions = { | |
tabBarLabel: 'Home!', | |
}; | |
const SettingsStack = createStackNavigator({ Settings: SettingsScreen }); | |
SettingsStack.navigationOptions = { | |
tabBarLabel: 'Settings!', | |
}; | |
const AppNavigator = createBottomTabNavigator({ HomeStack, SettingsStack }); | |
export default class App extends React.Component { | |
render() { | |
return <AppNavigator />; | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment