-
Notifications
You must be signed in to change notification settings - Fork 7
/
App.tsx
41 lines (34 loc) · 1.03 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
import React, { useEffect, useState } from "react";
import { Provider } from 'react-redux'
import Navigator from "./Navigator";
import { PersistGate } from 'redux-persist/integration/react';
import EncryptedStorage from 'react-native-encrypted-storage';
import configureStore from './src/store/store';
import { persistStore, persistReducer } from 'redux-persist';
const store = configureStore();
const persistor = persistStore(store);
const App = (props) => {
const [connect, setConnect] = useState(false);
const getConnectFlag = async () =>{
try {
const connectInfo = await EncryptedStorage.getItem("connect");
if (connectInfo == "1") {
setConnect(true);
}
}
catch (error) {
console.log(error);
}
}
useEffect(() => {
getConnectFlag();
}, []);
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<Navigator isLogin={!connect}/>
</PersistGate>
</Provider>
)
};
export default App;