-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainer.js
114 lines (100 loc) · 2.94 KB
/
Container.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import * as React from "react";
//Import Navigation Container
import { NavigationContainer } from "@react-navigation/native";
// Import Stack Navigation
import { createStackNavigator } from "@react-navigation/stack";
//Import Bottom Tab Navigation
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
//Import Icon
import { Ionicons } from "@expo/vector-icons";
// Import Theme Native Base
import { useTheme } from "native-base";
// Import Screen
import Welcome from "./src/screens/Welcome";
import CalcScreen from "./src/screens/CalcScreen";
import TodoLists from "./src/screens/TodoLists";
// Create Stack Navigation
const Stack = createStackNavigator();
//Create Bottom Tab Navigation
const Tab = createBottomTabNavigator();
// Create Component Bottom Tab Navigation
function MyTab() {
const theme = useTheme();
return (
<Tab.Navigator
initialRouteName="Welcome"
screenOptions={({ route }) => ({
headerMode: "screen",
headerTintColor: "white",
headerStyle: { backgroundColor: theme.colors.primary["300"] },
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === "Welcome") {
iconName = focused ? "ios-home" : "ios-home-outline";
} else if (route.name == "Calculator") {
iconName = focused ? "calculator-sharp" : "calculator-outline";
} else if (route.name == "Todo Lists") {
iconName = focused ? "list-sharp" : "list-outline";
}
return <Ionicons name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: theme.colors.primary["800"],
tabBarInactiveTintColor: "gray",
})}
>
<Tab.Screen
name="Welcome"
component={Welcome}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Calculator"
component={CalcScreen}
options={{ headerShown: false }}
/>
<Tab.Screen
name="Todo Lists"
component={TodoLists}
options={{ headerShown: false }}
/>
</Tab.Navigator>
);
}
export default function Container() {
// Init Theme
const theme = useTheme();
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="Welcome"
screenOptions={{
headerMode: "screen",
headerTintColor: "white",
headerStyle: { backgroundColor: theme.colors.primary["300"] },
}}
>
<Stack.Screen
name="Main"
component={MyTab}
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="Calculator"
component={CalcScreen}
options={{
title: "Calculator",
}}
/>
<Stack.Screen
name="Todo Lists"
component={TodoLists}
options={{
title: "Todo Lists",
}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}