import React, {useState, useEffect} from 'react';

// import all the components we are going to use
import {View, Text, Image, StyleSheet} from 'react-native';

const App = (props) => {
const [align, setAlign] = useState('center');
const [alignsecond, setAlignsecond] = useState(false);

useEffect(() => {
let myTimeout = setTimeout(() => {
setAlign('flex-start'), setAlignsecond(true);
}, 3000);
setTimeout(() => {
props.navigation.navigate('Home');
}, 5000);
return () => clearTimeout(myTimeout);
}, []);

return (
<View
style={[
styles.container,
{justifyContent: align}
]}>
<Image
source={
require('../assets/LogoEasy.png')
}
style={{width: 150, height: 150}}
/>
{!alignsecond ? null : (
<View style={{margin: 10}}>
<Text
style={{
color: '#114998',
fontSize: 30,
fontWeight: 'bold',
}}>
EasyFarma
</Text>
</View>
)}
</View>
);
};

export default App;

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
flexDirection: 'row',
marginHorizontal: 40,
},
});