-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
54 lines (46 loc) · 1.39 KB
/
index.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
52
53
54
import React from "react";
import { registerRootComponent } from "expo";
import { ExpoRoot } from "expo-router";
import { Provider } from "react-redux";
import { store } from "./services/state";
import { Platform } from "react-native";
import { persistStore } from "redux-persist";
import { PersistGate } from "redux-persist/es/integration/react";
import { ThemeProvider } from "@rneui/themed";
import * as SplashScreen from "expo-splash-screen";
import { useFonts } from "expo-font";
import FontAwesome from "@expo/vector-icons/FontAwesome";
const persistor = persistStore(store);
SplashScreen.preventAutoHideAsync();
setTimeout(SplashScreen.hideAsync, 2000);
export const App = () => {
React.useEffect(() => {
if (__DEV__ && Platform.OS !== "web") {
const rt = require("./services/reactotron").initReactotron;
rt();
}
}, []);
const [loaded, error] = useFonts({
SpaceMono: require("./assets/fonts/SpaceMono-Regular.ttf"),
...FontAwesome.font,
});
React.useEffect(() => {
if (loaded) {
SplashScreen.hideAsync();
}
}, [loaded]);
const ctx = require.context("./app");
if (!loaded) {
return null;
}
return (
<ThemeProvider>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<ExpoRoot context={ctx} />
</PersistGate>
</Provider>
</ThemeProvider>
);
};
registerRootComponent(App);