Skip to content

Instantly share code, notes, and snippets.

@kyo504
Created May 29, 2018 00:10
Show Gist options
  • Save kyo504/26a0e6978378a22e8e507da2827da681 to your computer and use it in GitHub Desktop.
Save kyo504/26a0e6978378a22e8e507da2827da681 to your computer and use it in GitHub Desktop.
shallow-navigation-options
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