-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
53 lines (46 loc) · 1.55 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
53
import React from 'react';
import { LogBox } from 'react-native';
import { Provider } from 'react-redux';
import { NavigationContainer } from '@react-navigation/native';
import RootStackNavigator from 'navigation/RootStackNavigator';
import { QueryClientProvider } from 'react-query';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { getData } from 'utils/asyncStorage';
import { storage } from 'utils/constants';
import store from 'redux/store';
import queryClient from 'network/queryClient';
import { UserType } from 'redux/types/authType';
LogBox.ignoreAllLogs();
LogBox.ignoreLogs([
"[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!",
]);
const App = () => {
const [userData, setUserData] = React.useState<UserType | null>(null);
const [initCompleted, setInitCompleted] = React.useState<boolean>(false);
React.useEffect(() => {
/** retrieve user data from local storage */
const fetchLocalStorage = async () => {
const ret = await getData(storage.user);
if (ret) {
setUserData(ret);
}
setInitCompleted(true);
};
fetchLocalStorage();
}, []);
if (!initCompleted) {
return null;
}
return (
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<SafeAreaProvider>
<NavigationContainer>
<RootStackNavigator userData={userData} />
</NavigationContainer>
</SafeAreaProvider>
</QueryClientProvider>
</Provider>
);
};
export default App;