import React, { useState } from "react"; import { View, Text, TextInput, TouchableOpacity, StyleSheet } from "react-native"; import { useAuth } from "@/context/auth-context"; import { router } from "expo-router"; export default function AuthScreen() { const [isLogin, setIsLogin] = useState(true); return isLogin ? ( setIsLogin(false)} /> ) : ( setIsLogin(true)} /> ); } function LoginScreen({ onSwitch }) { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const { login } = useAuth(); const handleLogin = async () => { const loginResult = await login(email, password); if (loginResult) { console.log("Login successful"); router.replace("/(tabs)"); } }; return ( Welcome Back Login Don't have an account? Register ); } function RegisterScreen({ onSwitch }) { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const handleRegister = () => { console.log("Register ->", { name, email, password }); }; return ( Create Account Register Already have an account? Login ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "center", padding: 20, backgroundColor: "#f5f5f5", }, title: { fontSize: 28, fontWeight: "bold", marginBottom: 30, textAlign: "center", }, input: { height: 50, borderColor: "#ccc", borderWidth: 1, borderRadius: 10, paddingHorizontal: 15, marginBottom: 15, backgroundColor: "#fff", }, button: { height: 50, backgroundColor: "#4CAF50", borderRadius: 10, justifyContent: "center", alignItems: "center", marginTop: 10, }, buttonText: { color: "#fff", fontSize: 16, fontWeight: "bold", }, link: { marginTop: 15, textAlign: "center", color: "#007BFF", }, });