armadiazrino

Untitled

Jun 23rd, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import {Text, ImageBackground} from 'react-native';
  2. import React, {useEffect} from 'react';
  3. import style from './style';
  4. import AsyncStorage from '@react-native-async-storage/async-storage';
  5.  
  6. const SplashScreen = props => {
  7. useEffect(() => {
  8. setTimeout(() => {
  9. AsyncStorage.getItem('isLoggedIn').then(value => {
  10. if (value === 'true') {
  11. props.navigation.reset({
  12. index: 0,
  13. routes: [{name: 'BottomTab'}],
  14. });
  15. } else {
  16. props.navigation.reset({
  17. index: 0,
  18. routes: [{name: 'Login'}],
  19. });
  20. }
  21. });
  22. }, 3000);
  23. }, [props.navigation]);
  24.  
  25. return (
  26. <ImageBackground
  27. style={style.container}
  28. source={require('../../assets/splash.jpg')}>
  29. <Text style={style.text}>Movie App</Text>
  30. </ImageBackground>
  31. );
  32. };
  33.  
  34. export default SplashScreen;
  35.  
Advertisement
Add Comment
Please, Sign In to add comment