import { StyleSheet, TextInput, View, Text, Image } from "react-native"; import { useState } from "react"; import Button from "../components/Button"; import { colors } from "../components/style"; import { Link, router } from "expo-router"; import { useAuth } from "./context/AuthContext"; function SignupPage() { const [pass1, setPass1] = useState(""); const [pass2, setPass2] = useState(""); const [email, setEmail] = useState(""); const [username, setUsername] = useState(""); const { onSignin } = useAuth(); async function signin() { if (pass1 == pass2) { const res = await onSignin(username, email, pass1); if (res.error) { if (res.msg.message == "validation error") { alert(res.msg.data.message); } else { alert(res.msg.message); } } if (!res.error) { alert("You have been successfully registered. Please Log In"); router.replace("/login"); } return; } alert("Passwords are not same!"); } return ( Please Sign Up setUsername(username)} /> setEmail(email)} /> setPass1(pass1)} /> setPass2(pass2)} />