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 { LinearGradient } from "expo-linear-gradient"; import { Animated } from "react-native"; 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) { alert("Passwords are not same!"); return; } const res = await onSignin(username, email, pass1); const data = await res.json(); if (res.status == 400) { if (data.message == "validation error") { alert(data.data.message); } else { alert("Something went wrong"); } return; } if (res.status == 201) { alert("You have been successfully registered. Please Log In"); router.replace("/login"); return; } } return ( Please Sign Up setUsername(username)} /> setEmail(email)} /> setPass1(pass1)} /> setPass2(pass2)} />