-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
44 lines (36 loc) · 1.13 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
import { useEffect, useCallback } from "react";
import * as SplashScreen from "expo-splash-screen";
import { StatusBar } from "expo-status-bar";
import { useFonts } from "expo-font";
import { Provider } from "react-redux";
import { ThemeProvider } from "styled-components";
import store from "./src/store/configureStore";
import { Routes } from "./src/routes";
import { AppProvider } from "./src/context";
import { defaultTheme } from "./src/theme/default";
import { fonts } from "./src/assets/fonts";
SplashScreen.preventAutoHideAsync();
export default function App() {
const [hasLoadedFonts] = useFonts(fonts);
const hideSplashScreen = useCallback(async () => {
if (hasLoadedFonts) {
await SplashScreen.hideAsync();
}
}, [hasLoadedFonts]);
useEffect(() => {
hideSplashScreen();
}, [hideSplashScreen]);
if (!hasLoadedFonts) {
return null;
}
return (
<Provider store={store}>
<ThemeProvider theme={defaultTheme}>
<StatusBar style="light" backgroundColor="transparent" translucent />
<AppProvider>
<Routes />
</AppProvider>
</ThemeProvider>
</Provider>
);
}