-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
97 lines (86 loc) · 2.91 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import React, { useEffect } from "react";
import { StyleSheet, Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import * as SplashScreen from "expo-splash-screen";
import OnboardingScreen from "./pages/OnboardingScreen";
import HomeScreen from "./pages/HomeScreen";
import ProfileScreen from "./pages/ProfileScreen";
import Search from "./pages/Search";
import RecPage from "./pages/Rec";
import StudioScreen from "./pages/StudioScreen";
import Register from "./pages/Register";
import Login from "./pages/Login";
import ChatScreen from "./pages/ChatScreen";
import BottomBar from "./components/BottomBar.js";
import {
useFonts,
Poppins_400Regular,
Poppins_700Bold,
} from "@expo-google-fonts/poppins";
import {
OpenSans_400Regular,
OpenSans_700Bold,
} from "@expo-google-fonts/open-sans";
import { FolderContextProvider } from "./context/FoldersContext";
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const MainScreen = () => {
return (
<Tab.Navigator tabBar={(props) => <BottomBar {...props} />}>
<Tab.Screen name="HomeScreen" component={HomeScreen} />
<Tab.Screen name="SearchScreen" component={Search} />
<Tab.Screen name="AddScreen" component={RecPage} />
<Tab.Screen name="MessageScreen" component={ChatScreen} />
<Tab.Screen name="ProfileScreen" component={ProfileScreen} />
</Tab.Navigator>
);
};
export default function App() {
let [fontsLoaded] = useFonts({
PoppinsRegular: Poppins_400Regular,
PoppinsBold: Poppins_700Bold,
OpenSansRegular: OpenSans_400Regular,
OpenSansBold: OpenSans_700Bold,
});
useEffect(() => {
const keepSplashScreen = async () => {
try {
await SplashScreen.preventAutoHideAsync();
} catch (err) {
console.warn(err);
}
};
keepSplashScreen();
}, []);
useEffect(() => {
const hideSplashScreen = async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
};
hideSplashScreen();
}, [fontsLoaded]);
return (
<FolderContextProvider>
<NavigationContainer initialRouteName="OnboardingScreen">
<Stack.Navigator
screenOptions={{
headerLeft: null,
...headerOptions.noHeader,
}}
>
<Stack.Screen name="OnboardingScreen" component={OnboardingScreen} />
<Stack.Screen name="Register" component={Register} />
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="MainScreen" component={MainScreen} />
<Stack.Screen name="Studio" component={StudioScreen} />
</Stack.Navigator>
</NavigationContainer>
</FolderContextProvider>
);
}
const headerOptions = {
noHeader: { title: "", headerStyle: { height: 0 } },
};