-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
59 lines (52 loc) · 1.75 KB
/
App.jsx
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
import * as React from "react";
import { useEffect, useState } from "react";
import { createDrawerNavigator } from "@react-navigation/drawer";
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import Home from "./screens/Home";
import BMI_Calculator from "./screens/BMI_Calculator";
import { COLOURS } from "./lib/colors/colors";
import AppLoading from "expo-app-loading";
import loadFonts from "./functions/loadFonts";
import EyeTest from "./screens/EyeTest";
const Drawer = createDrawerNavigator();
const customTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: COLOURS.primary,
},
};
const App = () => {
const [fontsLoaded, setFontsLoaded] = useState(false);
useEffect(() => {
try {
loadFonts();
setFontsLoaded(true);
} catch (e) {}
}, []);
if (!fontsLoaded) return <AppLoading />;
return (
<React.Fragment>
<NavigationContainer theme={customTheme}>
<Drawer.Navigator initialRouteName="Home">
<Drawer.Screen
name="Home"
component={Home}
options={{ headerShown: false }}
/>
<Drawer.Screen
name="BMI"
component={BMI_Calculator}
options={{ headerShown: false }}
/>
<Drawer.Screen
name="Eye Test"
component={EyeTest}
options={{ headerShown: false }}
/>
</Drawer.Navigator>
</NavigationContainer>
</React.Fragment>
);
};
export default App;