useSignUpOrLogIn hook initiates the Para signup or login flow for a given email or phone number. After calling it, use useVerifyNewAccount or useWaitForLogin to complete the flow.
Hook for initiating signup or login with email or phone
useSignUpOrLogIn hook initiates the Para signup or login flow for a given email or phone number. After calling it, use useVerifyNewAccount or useWaitForLogin to complete the flow.
import { useSignUpOrLogIn } from "@getpara/react-native-wallet";
import { useSignUpOrLogIn } from "@getpara/react-native-wallet";
import { useState } from "react";
import { View, TextInput, Button, Text } from "react-native";
function LoginScreen() {
const [email, setEmail] = useState("");
const { signUpOrLogInAsync, isPending } = useSignUpOrLogIn();
const handleSubmit = async () => {
try {
const result = await signUpOrLogInAsync({ auth: { email } });
// result is AuthStateVerify (new user) or AuthStateLogin (returning user)
} catch (err) {
console.error(err);
}
};
return (
<View>
<TextInput value={email} onChangeText={setEmail} placeholder="Email" />
<Button title={isPending ? "Sending..." : "Continue"} onPress={handleSubmit} disabled={isPending} />
</View>
);
}