import React, { useState } from 'react'; import { View, Text, TextInput, TouchableOpacity, SafeAreaView, StatusBar, Alert } from 'react-native'; import { router } from 'expo-router'; import { Feather } from '@expo/vector-icons'; import { useAuth } from './context/auth-context'; export default function LoginScreen() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [isLoading, setIsLoading] = useState(false); const { login } = useAuth(); const handleLogin = async () => { if (!email || !password) { Alert.alert('Error', 'Please fill in all fields'); return; } try { setIsLoading(true); await login(email, password); } catch (error) { Alert.alert('Error', 'Failed to login. Please try again.'); } finally { setIsLoading(false); } }; return ( {/* Back Button */} router.back()} > {/* Header */} Login to your account {/* Form */} Email Password setShowPassword(!showPassword)} > Forgot Password? {isLoading ? 'Logging in...' : 'Login'} {/* Sign Up Link */} Don't have an account? router.push('/signup')}> Sign Up ); }