Guest User

Untitled

a guest
May 23rd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. // tab navigator screens
  2. import HomeScreen from './screens/Home.js';
  3. import SearchScreen from './screens/Search.js';
  4. import MessageScreen from './screens/Message.js';
  5. import ProfileScreen from './screens/Profile.js';
  6.  
  7. static navigationOptions = {
  8. tabBarIcon: ({ focused, tintColor }) => (
  9. focused ? <Ionicons name={'ios-beer'} size={25} color={'#FFFFFF'} />
  10. : <Ionicons name={'ios-beer'} size={25} color={'#536497'} />
  11. ), tabBarPosition: 'bottom',
  12. tabBarOptions: {
  13. showLabel: false,
  14. activeTintColor: 'white',
  15. inactiveTintColor: '#536497',
  16. style: {
  17. backgroundColor: '#030e2c',
  18. }
  19. },
  20. animationEnabled: false,
  21. swipeEnabled: false,
  22. };
  23.  
  24. render() {
  25. return (
  26. <View style={styles.container}>
  27. <Button title="Show me more of the app" onPress={this._showMoreApp} />
  28. <Button title="Actually, sign me out :)" onPress={this._signOutAsync} />
  29. </View>
  30. );
  31. }
  32.  
  33. _showMoreApp = () => {
  34. this.props.navigation.navigate('Search');
  35. };
  36.  
  37. _signOutAsync = async () => {
  38. await AsyncStorage.clear();
  39. this.props.navigation.navigate('Auth');
  40. };
  41. }
  42.  
  43. const styles = StyleSheet.create({
  44. container: {
  45. backgroundColor: '#1c2e63',
  46. flex: 1,
  47. alignItems: 'center',
  48. justifyContent: 'center',
  49. },
  50. });
  51.  
  52. const AppTab = createBottomTabNavigator({ Home: HomeScreen, Search:
  53. SearchScreen, Message: MessageScreen, Profile: ProfileScreen });
  54.  
  55. const AuthStack = createStackNavigator({ SignIn: SignInScreen });
  56.  
  57. export default createSwitchNavigator(
  58. {
  59. AuthLoading: AuthLoadingScreen,
  60. App: AppTab,
  61. Auth: AuthStack,
  62. },
  63. {
  64. initialRouteName: 'AuthLoading',
  65. },
  66. );
Add Comment
Please, Sign In to add comment