-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
51 lines (42 loc) · 1.23 KB
/
App.tsx
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
import React, { useEffect } from "react";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { NavigationContainer } from "@react-navigation/native";
import { AuthProvider } from "./src/contexts/AuthContext";
import AppStack from "./src/navigations/AppStack";
SplashScreen.preventAutoHideAsync();
const AppRoot = () => {
const [fontsLoaded] = useFonts({
Roboto: require("./assets/fonts/Roboto/Roboto-Regular.ttf"),
"Roboto Bold": require("./assets/fonts/Roboto/Roboto-Bold.ttf"),
Nunito: require("./assets/fonts/Nunito/static/Nunito-Regular.ttf"),
"Nunito Bold": require("./assets/fonts/Nunito/static/Nunito-Bold.ttf"),
});
useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
await SplashScreen.preventAutoHideAsync();
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
} catch (e) {
console.warn(e);
}
}
loadResourcesAndDataAsync();
}, [fontsLoaded]);
if (!fontsLoaded) return null;
return (
<NavigationContainer>
<AppStack />
</NavigationContainer>
);
};
const App = () => {
return (
<AuthProvider>
<AppRoot />
</AuthProvider>
);
};
export default App;