-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplash.js
59 lines (47 loc) · 1.38 KB
/
Splash.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import AsyncStorage from '@react-native-async-storage/async-storage';
import React, { useEffect, useState } from 'react'
import { Image, SafeAreaView, StatusBar, Text, View, Dimensions, StyleSheet } from 'react-native'
const Splash = ({ navigation }) => {
const [animating, setAnimating] = useState(true);
const [isLogin, setIsLogin] = useState(false);
useEffect(async () => {
value = await AsyncStorage.getItem('isLogin')
console.log(JSON.parse(value))
setIsLogin(JSON.parse(value))
setTimeout(() => {
setAnimating(false);
if (JSON.parse(value)) {
console.log(JSON.parse(value))
console.log('Home')
navigation.replace('Home')
}
else {
console.log(JSON.parse(value))
console.log('Login')
navigation.replace('Login')
}
}, 10000)
}, []);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#59c098' }}>
<Image source={require('./src/footer.jpg')} style={{ width: 150, height: 150 }} />
</View>
)
}
export default Splash;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#000',
},
box: {
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#C53938',
height: 100,
width: 100,
overflow: 'hidden'
},
});