-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
110 lines (97 loc) · 3.49 KB
/
App.tsx
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator, StackNavigationOptions} from '@react-navigation/stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {
TabOneScreen,
TabTwoScreen,
TabThreeScreen,
TabFourScreen,
AboutScreen,
} from 'views';
import {Colors, Typography} from 'styles';
import { Icon } from 'components';
import { eIcons } from 'models';
const NavOptions: StackNavigationOptions = {
headerStyle: {
backgroundColor: Colors.greenDark,
},
headerTintColor: Colors.white,
headerTitleStyle: Typography.fontBold,
};
const TabOneStack = createStackNavigator();
const TabTwoStack = createStackNavigator();
const TabThreeStack = createStackNavigator();
const TabFourStack = createStackNavigator();
const AboutStack = createStackNavigator();
function TabOneStackScreen() {
return (
<TabOneStack.Navigator screenOptions={NavOptions}>
<TabOneStack.Screen name="Tab One" component={TabOneScreen} />
</TabOneStack.Navigator>
);
}
function TabTwoStackScreen() {
return (
<TabTwoStack.Navigator screenOptions={NavOptions}>
<TabTwoStack.Screen name="Tab Two" component={TabTwoScreen} />
</TabTwoStack.Navigator>
);
}
function TabThreeStackScreen() {
return (
<TabThreeStack.Navigator screenOptions={NavOptions}>
<TabThreeStack.Screen name="Tab Three" component={TabThreeScreen} />
</TabThreeStack.Navigator>
);
}
function TabFourStackScreen() {
return (
<TabFourStack.Navigator screenOptions={NavOptions}>
<TabFourStack.Screen name="Tab Four" component={TabFourScreen} />
</TabFourStack.Navigator>
);
}
function AboutStackScreen() {
return (
<AboutStack.Navigator screenOptions={NavOptions}>
<AboutStack.Screen name="About" component={AboutScreen} />
</AboutStack.Navigator>
);
}
const Tab = createBottomTabNavigator();
const App = () => {
return (
<NavigationContainer>
<Tab.Navigator
tabBarOptions={{activeTintColor: Colors.greenDark, inactiveTintColor: Colors.textDefault, labelStyle: {fontSize: Typography.fontSizeXXS}}}
screenOptions={({route}) => ({
tabBarIcon: ({focused, color, size}) => {
let iconName: eIcons = eIcons.tabOne;
if (route.name === 'Tab One') {
iconName = focused ? eIcons.tabOneFocused : eIcons.tabOne;
} else if (route.name === 'Tab Two') {
iconName = focused ? eIcons.tabTwoFocused : eIcons.tabTwo;
} else if (route.name === 'Tab Three') {
iconName = focused ? eIcons.tabThreeFocused : eIcons.tabThree;
} else if (route.name === 'Tab Four') {
iconName = focused ? eIcons.tabFourFocused : eIcons.tabFour;
} else if (route.name === 'About') {
iconName = focused ? eIcons.aboutFocused : eIcons.about;
}
// You can return any component that you like here!
return (
<Icon icon={iconName} iconSize={size} color={Colors.greenDark} />
);
},
})}>
<Tab.Screen name="Tab One" component={TabOneStackScreen} />
<Tab.Screen name="Tab Two" component={TabTwoStackScreen} />
<Tab.Screen name="Tab Three" component={TabThreeStackScreen} />
<Tab.Screen name="Tab Four" component={TabFourStackScreen} />
<Tab.Screen name="About" component={AboutStackScreen} />
</Tab.Navigator>
</NavigationContainer>
);
};
export default App;