-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppContainer.js
90 lines (81 loc) · 2.28 KB
/
AppContainer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import React from 'react';
import {
createAppContainer,
createBottomTabNavigator,
createSwitchNavigator,
createStackNavigator
} from 'react-navigation';
import {Ionicons} from '@expo/vector-icons';
import {Platform} from "react-native";
import HomeScreen from './screens/HomeScreen';
import GameScreen from './screens/GameScreen';
import AchievementsScreen from './screens/AchievementsScreen';
import RecordsHistoryScreen from './screens/RecordsHistoryScreen';
const GameNavigator = createSwitchNavigator({
HomeScreen: {screen: HomeScreen},
GameScreen: {screen: GameScreen},
});
GameNavigator.navigationOptions = ({navigation}) => {
//hide TabNavigator on the GameScreen
let tabBarVisible = true;
if (navigation.state.index > 0) {
tabBarVisible = false;
}
return {
tabBarVisible,
};
};
const AchievementsNavigator = createStackNavigator({
Achievements: {
screen: AchievementsScreen,
navigationOptions: {
title: 'Achievements'
}
},
RecordsHistory: {
screen: RecordsHistoryScreen,
navigationOptions: {
title: 'Records History'
}
}
})
const TabNavigator = createBottomTabNavigator({
HomeTab: {
screen: GameNavigator,
navigationOptions: {
title: 'Game!',
tabBarIcon: () => {
return <Ionicons name='logo-game-controller-b' size={25} color='white'/>;
}
},
},
AchievementsTab: {
screen: AchievementsNavigator,
navigationOptions: {
title: 'Achievements!',
tabBarIcon: () => {
return <Ionicons name={Platform.OS === "ios" ? "ios-trophy" : "md-trophy"} size={25} color='white'/>;
}
}
}
},
{
tabBarOptions: {
activeBackgroundColor: '#085f63',
labelStyle: {
fontSize: 15,
color: 'white',
},
style: {
backgroundColor: '#49beb7',
},
}
});
const App = createAppContainer(TabNavigator);
export default class AppContainer extends React.Component {
render() {
return (
<App/>
)
}
}