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 ( ) } export default connect(mapStateToProps)(Splash);