-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
62 lines (52 loc) · 1.71 KB
/
App.js
File metadata and controls
62 lines (52 loc) · 1.71 KB
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
import React, { useEffect, useState } from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createDrawerNavigator } from "@react-navigation/drawer";
import DrawerContent from "./drawers/DrawerContent";
import MainStack from "./drawers/MainStack";
import * as Font from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { Text, TextInput } from "react-native";
import AppStyles from "./AppStyles";
SplashScreen.preventAutoHideAsync();
const Drawer = createDrawerNavigator();
const App = () => {
const [fontsLoaded, setFontsLoaded] = useState(false);
useEffect(() => {
const loadFonts = async () => {
await Font.loadAsync({
"Montserrat-Medium": require("./assets/fonts/Montserrat-Medium.ttf"),
"Montserrat-Bold": require("./assets/fonts/Montserrat-Bold.ttf"),
});
setFontsLoaded(true);
SplashScreen.hideAsync();
};
loadFonts();
}, []);
if (!fontsLoaded) {
return null;
}
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.style = AppStyles.text;
TextInput.defaultProps = TextInput.defaultProps || {};
TextInput.defaultProps.style = AppStyles.textInput;
return (
<NavigationContainer>
<Drawer.Navigator
drawerContent={(props) => <DrawerContent {...props} />}
screenOptions={{
drawerType: "front",
headerShown: false,
swipeEnabled: false,
overlayColor: "#00000060",
drawerStyle: {
backgroundColor: "#131111",
width: 250,
},
}}
>
<Drawer.Screen name="MainStack" component={MainStack} />
</Drawer.Navigator>
</NavigationContainer>
);
};
export default App;