import { useAuth } from "@/context/auth-context"; import { Feather } from "@expo/vector-icons"; import { router } from "expo-router"; import React, { useState } from "react"; import { Alert, SafeAreaView, StatusBar, Text, TextInput, TouchableOpacity, View, } from "react-native"; 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 ); }