text: //React
  import React, { useState } from 'react';
  import { Text, Alert } from 'react-native';
  
  //React Navigation
  import { useNavigation } from '@react-navigation/native';
  
  //Hooks
  import { useAuth } from '../../hooks/useAuth';
  
  //Components
  import Input from '../../components/Input';
  import ButtonSubmit from '../../components/ButtonSubmit';
  import LinkAccount from '../../components/LinkAccount';
  
  //Styles
  import { Container, Logo } from './styles';
  
  export default function SignIn() {
    const [email, setEmail] = useState('');
    const [password, setPassword] = useState('');
  
    const { signIn } = useAuth();
  
    const navigation = useNavigation();
  
    function navigateToSignUp() {
      navigation.navigate('SignUp');
    }
  
    function handleSignIn() {
      if (email === '') {
        Alert.alert('Campo email em branco');
        return;
      }
  
      if (password === '') {
        Alert.alert('Campo senha em branco');
        return;
      }
  
      signIn(email, password);
    }
  
    return (
      <Container>
        <Logo>
          Dev<Text style={{ color: '#e52246' }}>Post</Text>
        </Logo>
  
        <Input
          placeholder="E-mail"
          onChangeText={(t) => setEmail(t)}
          value={email}
        />
  
        <Input
          placeholder="Senha"
          onChangeText={(t) => setPassword(t)}
          value={password}
          secureTextEntry={true}
        />
  
        <ButtonSubmit
          title="Acessar"
          backgroundColor="#418cfd"
          onPress={handleSignIn}
        />
        <LinkAccount title="Não possui uma conta?" onPress={navigateToSignUp} />
      </Container>
    );
  }
  