import { authClient } from "@/lib/auth-client"; {{#if (eq api "trpc")}} import { queryClient } from "@/utils/trpc"; {{/if}} {{#if (eq api "orpc")}} import { queryClient } from "@/utils/orpc"; {{/if}} import { useState } from "react"; import { ActivityIndicator, Text, TextInput, TouchableOpacity, View, } from "react-native"; export function SignUp() { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const handleSignUp = async () => { setIsLoading(true); setError(null); await authClient.signUp.email( { name, email, password, }, { onError: (error) => { setError(error.error?.message || "Failed to sign up"); setIsLoading(false); }, onSuccess: () => { setName(""); setEmail(""); setPassword(""); queryClient.refetchQueries(); }, onFinished: () => { setIsLoading(false); }, }, ); }; return ( Create Account {error && ( {error} )} {isLoading ? ( ) : ( Sign Up )} ); }