import React, { useState } from 'react'; import { View, Text, TextInput, TouchableOpacity, SafeAreaView, StatusBar, Alert, ScrollView } from 'react-native'; import { router } from 'expo-router'; import { Feather } from '@expo/vector-icons'; import { useAuth } from './context/auth-context'; 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); await signup(name, email, password); } 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 ); }