-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
52 lines (45 loc) · 1.35 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
52
import "react-native-gesture-handler";
import React, {useCallback, useEffect, useState} from "react";
import {I18nManager} from "react-native";
import {Provider} from "react-redux";
import {enableFreeze} from "react-native-screens";
import {connectToDevTools} from "react-devtools-core";
import {store} from "./app/store/getStore";
import {fetchData} from "./app/utils/fetchData";
import ThemeNavigator from "./app/navigations/ThemeNavigator";
import {DarkThemeProvider} from "./app/contexts/ThemeContext";
import {AdProvider} from "./app/contexts/AdContext";
if (__DEV__) {
connectToDevTools({
host: "localhost",
port: 8097,
});
}
const App: React.FC = ({}) => {
const [loading, setLoading] = useState(true);
const [myStore] = useState(store);
try {
I18nManager.forceRTL(false);
I18nManager.allowRTL(false);
} catch (e) {}
const fetch = useCallback(async () => {
await fetchData();
setLoading(false);
}, []);
useEffect(() => {
fetch();
}, [fetch]);
useEffect(() => {
enableFreeze(true);
}, []);
return (
<Provider store={myStore}>
{/* <AdProvider> */}
<DarkThemeProvider>
<ThemeNavigator />
</DarkThemeProvider>
{/* </AdProvider> */}
</Provider>
);
};
export default App;