diff options
Diffstat (limited to 'src/app/(auth)/login.tsx')
| -rw-r--r-- | src/app/(auth)/login.tsx | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/app/(auth)/login.tsx b/src/app/(auth)/login.tsx index e69de29..5664bbf 100644 --- a/src/app/(auth)/login.tsx +++ b/src/app/(auth)/login.tsx @@ -0,0 +1,80 @@ +import { Link } from 'expo-router'; +import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; +import { useLogin } from '@/features/auth/hooks/useLogin'; + +export default function LoginScreen() { + const { email, password, setEmail, setPassword, submit, isSubmitting, error } = useLogin(); + + return ( + <View style={styles.container}> + <Text style={styles.title}>Iniciar sesión</Text> + + <TextInput + style={styles.input} + placeholder="Correo electrónico" + autoCapitalize="none" + keyboardType="email-address" + value={email} + onChangeText={setEmail} + /> + + <TextInput + style={styles.input} + placeholder="Contraseña" + secureTextEntry + value={password} + onChangeText={setPassword} + /> + + {error ? <Text style={styles.error}>{error}</Text> : null} + + <Pressable style={styles.button} onPress={submit} disabled={isSubmitting}> + <Text style={styles.buttonText}> + {isSubmitting ? 'Entrando...' : 'Entrar'} + </Text> + </Pressable> + + <Link href="/(auth)/register" style={styles.link}> + ¿No tienes cuenta? Regístrate + </Link> + </View> + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + padding: 24, + gap: 12, + }, + title: { + fontSize: 28, + fontWeight: '700', + marginBottom: 16, + }, + input: { + borderWidth: 1, + borderColor: '#ccc', + borderRadius: 10, + paddingHorizontal: 14, + paddingVertical: 12, + }, + button: { + backgroundColor: '#1f6feb', + paddingVertical: 14, + borderRadius: 10, + alignItems: 'center', + marginTop: 8, + }, + buttonText: { + color: '#fff', + fontWeight: '600', + }, + error: { + color: 'red', + }, + link: { + marginTop: 12, + }, +}); |