-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
76 lines (68 loc) · 3.04 KB
/
App.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
import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import { useFonts } from "expo-font";
import AppContext from "./src/Context/AppContext";
import Ionicons from "react-native-vector-icons/Ionicons";
import { Home } from "./src/screens/Home";
import AccountNav from "./src/screens/MyAccount/_AccountNav";
import PantryNav from "./src/screens/MyPantry/_PantryNav";
import PlanNav from "./src/screens/PlanDinner/_PlanNav";
import RecipeNav from "./src/screens/RecipePage/_RecipeNav";
// import TestNav from "./src/screens/TestPage/_TestNav";
// This import allows the dev to save states between screens
import initializeVariables from "./src/Context/StateInitializer";
const Tab = createBottomTabNavigator();
export default function App() {
const stateVariables = initializeVariables();
const [fontsLoaded] = useFonts({
Poppins: require("./assets/fonts/Poppins-Regular.ttf"),
UbuntuBold: require("./assets/fonts/Ubuntu-Bold.ttf"),
Ubuntu: require("./assets/fonts/Ubuntu-Regular.ttf"),
HappyMonkey: require("./assets/fonts/HappyMonkey-Regular.ttf"),
NunitoSans: require("./assets/fonts/NunitoSans-Regular.ttf"),
});
if (!fontsLoaded) {
return null;
}
return (
<AppContext.Provider value={stateVariables}>
<NavigationContainer>
<Tab.Navigator
initialRouteName="Home"
options={{ headerShown: false }}
screenOptions={({ route }) => ({
headerShown: false,
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === "Recipe") {
iconName = focused ? "restaurant" : "restaurant";
} else if (route.name === "Profile") {
iconName = focused ? "person-circle" : "person-circle";
} else if (route.name === "Plan Meal") {
iconName = focused ? "calendar" : "calendar";
} else if (route.name === "Pantry") {
iconName = focused ? "fast-food" : "fast-food";
} else if (route.name === "Home") {
iconName = focused ? "home" : "home";
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={30} color={color} />;
},
tabBarActiveTintColor: "#D3FAD9",
tabBarInactiveTintColor: "#47c053",
tabBarStyle: { backgroundColor: "#333333", height: 70 },
tabBarLabelStyle: { fontSize: 12, height: 25, marginTop: -10 },
})}
>
<Tab.Screen name="Profile" component={AccountNav} />
<Tab.Screen name="Plan Meal" component={PlanNav} />
<Tab.Screen name="Home" component={Home} />
{/* <Tab.Screen name="Test" component={TestNav} /> */}
<Tab.Screen name="Recipe" component={RecipeNav} />
<Tab.Screen name="Pantry" component={PantryNav} />
</Tab.Navigator>
</NavigationContainer>
</AppContext.Provider>
);
}