splash screen and redux
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { View, Text } from 'react-native'
|
||||
import React from 'react'
|
||||
|
||||
const Login = () => {
|
||||
return (
|
||||
<View>
|
||||
<Text>Login</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default Login
|
||||
@@ -0,0 +1,99 @@
|
||||
import {View, Text, Image, Dimensions, StyleSheet} from 'react-native';
|
||||
import React, {useEffect} from 'react';
|
||||
import IMAGES from '../../../constants/Images';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import {useDispatch} from 'react-redux';
|
||||
|
||||
const SplashScreen = ({navigation}) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
// const get_token = async () => {
|
||||
// let token = await AsyncStorage.getItem('@Collector_User');
|
||||
// console.log(token);
|
||||
|
||||
// token = JSON.parse(token);
|
||||
|
||||
// if (token) {
|
||||
// dispatch(setUser(token));
|
||||
// navigation.reset({
|
||||
// index: 0,
|
||||
// routes: [{name: 'mainStack', params: {screen: 'dashboard'}}],
|
||||
// });
|
||||
// } else {
|
||||
// setTimeout(() => {
|
||||
// navigation.reset({
|
||||
// index: 0,
|
||||
// routes: [{name: 'Login'}],
|
||||
// });
|
||||
// }, 2000);
|
||||
// }
|
||||
// };
|
||||
|
||||
useEffect(() => {
|
||||
// get_token();
|
||||
setTimeout(() => {
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [{name: 'Login'}],
|
||||
});
|
||||
}, 4000);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.backgroundContainer}>
|
||||
<Image
|
||||
source={IMAGES.splashFullImg}
|
||||
resizeMode="stretch"
|
||||
style={styles.backdrop}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.overlay}>
|
||||
<Image style={styles.logo} source={IMAGES.AppLogo} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default SplashScreen;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
backgroundContainer: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
overlay: {
|
||||
opacity: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
logo: {
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
height: 200,
|
||||
width: 200,
|
||||
overflow: 'hidden',
|
||||
resizeMode: 'contain',
|
||||
marginTop: 5,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
backdrop: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
headline: {
|
||||
fontSize: 18,
|
||||
textAlign: 'center',
|
||||
backgroundColor: 'black',
|
||||
color: 'white',
|
||||
//borderWidth:1
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user