Skip to content

Instantly share code, notes, and snippets.

@kyo504
Created May 28, 2018 15:23
Show Gist options
  • Save kyo504/9ec2c67f5fc35d5095b1aa21206b0c02 to your computer and use it in GitHub Desktop.
Save kyo504/9ec2c67f5fc35d5095b1aa21206b0c02 to your computer and use it in GitHub Desktop.
deep-navigation-options
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StackNavigator, TabNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
static navigationOptions = { tabBarLabel: 'Home!' };
render() {
return (
<View style={styles.container}>
<Text>HomeScreen</Text>
</View>
)
}
}
class SettingsScreen extends React.Component {
static navigationOptions = { tabBarLabel: 'Settings!' };
render() {
return (
<View style={styles.container}>
<Text>SettingsScreen</Text>
</View>
)
}
}
const HomeStack = StackNavigator({ Home: HomeScreen });
const SettingsStack = StackNavigator({ Settings: SettingsScreen });
const AppNavigator = TabNavigator({ HomeStack, SettingsStack });
export default class App extends 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