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, ScrollView, StatusBar, Text, TextInput, TouchableOpacity, View, } from "react-native"; export default function SignupScreen() { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [isLoading, setIsLoading] = useState(false); const { signup } = useAuth(); const handleSignup = async () => { if (!name || !email || !password || !confirmPassword) { Alert.alert("Error", "Please fill in all fields"); return; } if (password !== confirmPassword) { Alert.alert("Error", "Passwords do not match"); return; } try { setIsLoading(true); // Only pass email and password to signup, as per new auth-context await signup(email, password); // Optionally, save name to profile after signup here in the future } catch (error) { Alert.alert("Error", "Failed to sign up. Please try again."); } finally { setIsLoading(false); } }; return ( {/* Back Button */} router.back()} > {/* Header */} Create an account {/* Form */} Full Name Email Password setShowPassword(!showPassword)} > Confirm Password setShowPassword(!showPassword)} > {isLoading ? "Signing up..." : "Sign Up"} {/* Login Link */} Already have an account? router.push("/login")}> Login ); }