/**
* Forgot Password Screen
*
* Password recovery screen
*/
import { useState } from 'react';
import {
View,
Text,
TextInput,
TouchableOpacity,
StyleSheet,
KeyboardAvoidingView,
Platform,
ActivityIndicator,
Alert,
} from 'react-native';
import { router } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
export default function ForgotPasswordScreen() {
const [email, setEmail] = useState('');
const [isSubmitting, setIsSubmitting] = useState(false);
const [isSubmitted, setIsSubmitted] = useState(false);
const handleSubmit = async () => {
if (!email) {
Alert.alert('Error', 'Por favor ingresa tu email');
return;
}
setIsSubmitting(true);
try {
// TODO: Implement password reset API call
// await authApi.requestPasswordReset(email);
// Simulate API call
await new Promise((resolve) => setTimeout(resolve, 1500));
setIsSubmitted(true);
} catch (error: any) {
Alert.alert('Error', error.message || 'No se pudo enviar el email de recuperación');
} finally {
setIsSubmitting(false);
}
};
if (isSubmitted) {
return (
Revisa tu correo
Hemos enviado instrucciones para restablecer tu contraseña a {email}
router.back()}
>
Volver al inicio de sesión
);
}
return (
{/* Back button */}
router.back()}>
{/* Header */}
¿Olvidaste tu contraseña?
Ingresa tu email y te enviaremos instrucciones para restablecerla
{/* Form */}
Email
{isSubmitting ? (
) : (
Enviar instrucciones
)}
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f8fafc',
},
content: {
flex: 1,
padding: 24,
justifyContent: 'center',
},
backButton: {
position: 'absolute',
top: 60,
left: 24,
zIndex: 1,
},
header: {
marginBottom: 32,
},
title: {
fontSize: 24,
fontWeight: '700',
color: '#1f2937',
marginBottom: 8,
},
subtitle: {
fontSize: 16,
color: '#64748b',
lineHeight: 24,
},
form: {
gap: 16,
},
inputContainer: {
gap: 4,
},
label: {
fontSize: 14,
fontWeight: '500',
color: '#374151',
marginBottom: 4,
},
input: {
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#d1d5db',
borderRadius: 8,
paddingHorizontal: 16,
paddingVertical: 12,
fontSize: 16,
color: '#1f2937',
},
button: {
backgroundColor: '#1e40af',
borderRadius: 8,
paddingVertical: 14,
alignItems: 'center',
marginTop: 8,
},
buttonDisabled: {
backgroundColor: '#93c5fd',
},
buttonText: {
color: '#ffffff',
fontSize: 16,
fontWeight: '600',
},
successIcon: {
alignItems: 'center',
marginBottom: 24,
},
successTitle: {
fontSize: 24,
fontWeight: '700',
color: '#1f2937',
textAlign: 'center',
marginBottom: 12,
},
successText: {
fontSize: 16,
color: '#64748b',
textAlign: 'center',
lineHeight: 24,
marginBottom: 32,
},
});