-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
80 lines (70 loc) · 2.38 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
import "react-native-gesture-handler";
import { LogBox, StyleSheet, Text, View } 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 AsyncStorage from "@react-native-async-storage/async-storage";
import AppNavigation from "./navigation/AppNavigator";
import { Provider } from "react-redux";
import { Store } from "./store/store";
AsyncStorage.clear()
LogBox.ignoreLogs(['AsyncStorage has been extracted'])
SplashScreen.preventAutoHideAsync();
export default function App() {
const [appIsLoaded, setAppIsLoaded] = useState(false);
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 {
console.log("works");
setAppIsLoaded(true);
console.log(appIsLoaded);
}
};
prepare();
}, []);
const changeSplash = useCallback(async () => {
if (appIsLoaded) {
await SplashScreen.hideAsync();
console.log("remove");
}
}, [appIsLoaded]);
if (!appIsLoaded) {
console.log("neww");
return null;
}
return (
<Provider store={Store}>
<SafeAreaProvider onLayout={changeSplash} style = {styles.container}>
<AppNavigation/>
</SafeAreaProvider>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
fontFamily:"black",
},
label: {
color: "black",
fontSize: 100,
fontFamily: "regular",
},
});