-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
97 lines (84 loc) · 2.82 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 { LogBox, StyleSheet, Text } from "react-native";
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
import * as SplashScreen from 'expo-splash-screen';
import { useCallback, useEffect, useState } from "react";
import * as Font from 'expo-font';
import "react-native-gesture-handler";
import AppNavigator from "./navigation/AppNavigator";
import { Provider } from "react-redux";
import { store } from "./store/store";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { MenuProvider } from "react-native-popup-menu";
LogBox.ignoreLogs(["AsyncStorage has been extracted from react-native core and will be removed in a future release."]);
// AsyncStorage.clear()
SplashScreen.preventAutoHideAsync();
export default function App() {
const [appIsLoaded, setAppIsLoaded] = useState(false);
if (__DEV__) {
const ignoreWarns = ["VirtualizedLists should never be nested inside plain ScrollViews"];
const errorWarn = global.console.error;
global.console.error = (...arg) => {
for (const error of ignoreWarns) {
if (arg[0].startsWith(error)) {
return;
}
}
errorWarn(...arg);
};
}
useEffect(() => {
const prepare = async () => {
try {
await Font.loadAsync({
"black": require("./assets/fonts//Roboto-Black.ttf"),
"blackItalic": require("./assets/fonts/Roboto-BlackItalic.ttf"),
"bold": require("./assets/fonts/Roboto-Bold.ttf"),
"boldItalic": require("./assets/fonts/Roboto-BoldItalic.ttf"),
"italic": require("./assets/fonts/Roboto-Italic.ttf"),
"light": require("./assets/fonts/Roboto-Light.ttf"),
"lightItalic": require("./assets/fonts/Roboto-LightItalic.ttf"),
"medium": require("./assets/fonts/Roboto-Medium.ttf"),
"mediumItalic": require("./assets/fonts/Roboto-MediumItalic.ttf"),
"regular": require("./assets/fonts/Roboto-Regular.ttf"),
"thin": require("./assets/fonts/Roboto-Thin.ttf"),
"thinItalic": require("./assets/fonts/Roboto-ThinItalic.ttf"),
});
}
catch (error) {
console.log.error();
}
finally {
setAppIsLoaded(true);
}
};
prepare();
}, []);
const onLayout = useCallback(async () => {
if (appIsLoaded) {
await SplashScreen.hideAsync();
}
}, [appIsLoaded]);
if (!appIsLoaded) {
return null;
}
return (
<Provider store={store}>
<SafeAreaProvider style={styles.container} onLayout={onLayout}>
<MenuProvider>
<AppNavigator />
</MenuProvider>
</SafeAreaProvider>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
label: {
color: 'black',
fontSize: 18,
fontFamily: "regular"
}
});