You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1006 B
41 lines
1006 B
import React, {useEffect} from 'react' |
|
import {View, Text, Image, ActivityIndicator, Dimensions} from 'react-native'; |
|
import {connect} from 'react-redux'; |
|
import Logo from '../../assets/images/logo.png'; |
|
|
|
const {width, height} = Dimensions.get('window'); |
|
|
|
const mapStateToProps = state => { |
|
return { |
|
profile: state.profile |
|
} |
|
} |
|
|
|
function Splash({navigation, profile}) { |
|
|
|
useEffect(() => { |
|
setTimeout(() => { |
|
!profile.token ? navigation.reset({ |
|
index: 0, |
|
// routes: [{ name: 'Login' }], |
|
routes: [{ name: 'QR' }], |
|
|
|
}) : navigation.reset({ |
|
index: 0, |
|
routes: [{ name: 'Home' }], |
|
}) |
|
}, 2000) |
|
}, []) |
|
|
|
return ( |
|
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}> |
|
<Image source={Logo} style={{ |
|
width: width * 0.7, |
|
height: width * 0.7 / 2.09, |
|
}} /> |
|
<ActivityIndicator size={'large'} style={{marginTop: 20}}/> |
|
</View> |
|
) |
|
} |
|
|
|
export default connect(mapStateToProps)(Splash);
|
|
|