-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
54 lines (47 loc) · 1.31 KB
/
App.tsx
File metadata and controls
54 lines (47 loc) · 1.31 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
import { QueryClient } from "@tanstack/query-core";
import { QueryClientProvider } from "@tanstack/react-query";
import { loadAsync } from "expo-font";
import App from "./src/App";
import { useEffect, useState } from "react";
import { hideAsync, preventAutoHideAsync } from "expo-splash-screen";
import {
GestureHandlerRootView,
} from "react-native-gesture-handler";
preventAutoHideAsync();
async function loadApplication() {
await loadAsync({
"Exo 2": require("./assets/fonts/Exo2-Regular.ttf"),
"Exo 2 Bold": require("./assets/fonts/Exo2-Bold.ttf"),
"Exo 2 Light": require("./assets/fonts/Exo2-Light.ttf"),
"Exo 2 Medium": require("./assets/fonts/Exo2-Medium.ttf"),
"Exo 2 SemiBold": require("./assets/fonts/Exo2-SemiBold.ttf"),
"Exo 2 Thin": require("./assets/fonts/Exo2-Thin.ttf"),
});
}
export default function Main() {
const client = new QueryClient();
const [isReady, setIsReady] = useState(false);
useEffect(() => {
async function prepare() {
try {
await loadApplication();
} catch (e) {
console.warn(e);
} finally {
setIsReady(true);
hideAsync();
}
}
prepare();
}, []);
if (!isReady) {
return null;
}
return (
<QueryClientProvider client={client}>
<GestureHandlerRootView style={{ flex: 1 }}>
<App />
</GestureHandlerRootView>
</QueryClientProvider>
);
}