diff --git a/app.json b/app.json index aca253e..7c9f78a 100644 --- a/app.json +++ b/app.json @@ -10,7 +10,7 @@ "splash": { "image": "./assets/images/splash.png", "resizeMode": "contain", - "backgroundColor": "#ffffff" + "backgroundColor": "#2F80ED" }, "ios": { "supportsTablet": true diff --git a/app/(auth)/sign-in.tsx b/app/(auth)/sign-in.tsx index 2ef0691..05d9bc5 100644 --- a/app/(auth)/sign-in.tsx +++ b/app/(auth)/sign-in.tsx @@ -75,8 +75,6 @@ const SignIn = () => { Sign up - - {/* Verification Modal */} ); diff --git a/app/(auth)/sign-up.tsx b/app/(auth)/sign-up.tsx index 7ee8ccf..c6e35f2 100644 --- a/app/(auth)/sign-up.tsx +++ b/app/(auth)/sign-up.tsx @@ -1,7 +1,8 @@ import { useSignUp } from "@clerk/clerk-expo"; -import { Link } from "expo-router"; +import { Link, router } from "expo-router"; import { useState } from "react"; -import { Image, ScrollView, Text, View } from "react-native"; +import { Alert, Image, ScrollView, Text, View } from "react-native"; +import ReactNativeModal from "react-native-modal"; import { CustomButton } from "@/components/custom-button"; import { InputField } from "@/components/input-field"; @@ -30,7 +31,6 @@ const SignUp = () => { await signUp.create({ emailAddress: form.email, password: form.password, - firstName: form.name, }); await signUp.prepareEmailAddressVerification({ strategy: "email_code" }); @@ -39,8 +39,13 @@ const SignUp = () => { ...prevVerification, state: "pending", })); + + setForm((prevForm) => ({ + ...prevForm, + password: "", + })); } catch (err: any) { - console.error(JSON.stringify(err, null, 2)); + Alert.alert("Error", err?.errors[0]?.longMessage); } }; @@ -66,10 +71,8 @@ const SignUp = () => { error: "Verification failed.", state: "failed", })); - console.error(JSON.stringify(completeSignUp, null, 2)); } } catch (err: any) { - console.error(JSON.stringify(err, null, 2)); setVerification((prevVerification) => ({ ...prevVerification, error: err?.errors[0]?.longMessage, @@ -152,7 +155,73 @@ const SignUp = () => { - {/* Verification Modal */} + + setVerification((prevVerification) => ({ + ...prevVerification, + state: "success", + })) + } + isVisible={verification.state === "pending"} + > + + + Verification + + + + We've sent a verification code to {form.email} + + + + setVerification((prevVerification) => ({ + ...prevVerification, + code, + })) + } + /> + + {verification.error && ( + + {verification.error} + + )} + + + + + + + + + + Verified + + + + You've succesfully verified your accound. + + + router.replace("/(root)/(tabs)/home")} + className="mt-5" + /> + + ); diff --git a/lib/auth.ts b/lib/auth.ts index cdc3ac1..cb1ba6b 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -17,7 +17,7 @@ export const tokenCache = { } return item; } catch (error) { - console.error("SecureStore get item error: ", error); + console.error("GET_TOKEN_CACHE: ", error); await SecureStore.deleteItemAsync(key); return null; } @@ -26,7 +26,7 @@ export const tokenCache = { try { return SecureStore.setItemAsync(key, value); } catch (err) { - console.error("TOKEN_CACHE: ", err); + console.error("SAVE_TOKEN_CACHE: ", err); return; }