aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding/Splash.tsx
blob: 332b73b52ba5613ca75141cc21b619412f1d22b0 (plain)
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
import React, {useEffect} from 'react';
import {RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import {Background} from '../../components';
import {Image, StyleSheet} from 'react-native';
import {OnboardingStackParams} from '../../routes';

type SplashScreenRouteProp = RouteProp<OnboardingStackParams, 'Login'>;
type SplashScreenNavigationProp = StackNavigationProp<
  OnboardingStackParams,
  'Login'
>;
interface SplashProps {
  route: SplashScreenRouteProp;
  navigation: SplashScreenNavigationProp;
}
const Splash: React.FC<SplashProps> = ({navigation}) => {
  useEffect(() => {
    const timer = setTimeout(() => navigation.navigate('Login'), 1500);
    return () => clearTimeout(timer);
  }, [navigation]);
  return (
    <Background centered>
      <Image
        source={require('../../assets/images/logo.png')}
        style={styles.logo}
      />
    </Background>
  );
};
const styles = StyleSheet.create({
  logo: {
    width: 284,
    height: 197,
    marginBottom: 0,
  },
});

export default Splash;