-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
44 lines (40 loc) · 1.1 KB
/
App.js
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 auth from '@react-native-firebase/auth';
import React, { useEffect, useState } from 'react';
import 'react-native-gesture-handler';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/lib/integration/react';
import Boot from './navigation/Boot';
import { persistor, store } from './redux/store';
import SplashScreen from './screens/SplashScreen';
const App = () => {
const [isLogin, setIslogin] = useState(false);
const [loading, setloading] = useState(false);
useEffect(() => {
const timer = setTimeout(() => {
changeStatusUser();
setloading(true);
}, 5000);
return () => clearTimeout(timer);
}, [isLogin]);
const changeStatusUser = () => {
auth().onAuthStateChanged(function (user) {
if (user) {
setIslogin(true);
} else {
setIslogin(false);
}
});
};
if (!loading) {
return <SplashScreen />;
} else {
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<Boot isLogin={isLogin} />
</PersistGate>
</Provider>
);
}
};
export default App;