11import { zodResolver } from "@hookform/resolvers/zod"
22import { Link , useRouter } from "expo-router"
33import { Controller , useForm } from "react-hook-form"
4- import { ScrollView , View } from "react-native"
4+ import { ScrollView } from "react-native"
55import { Button , Input , Typography } from "../../src/components"
66import { useAuthStore } from "../../src/store/useAuthStore"
77import { colors , spacing } from "../../src/theme/tokens"
@@ -10,6 +10,7 @@ import { type RegisterFormValues, registerSchema } from "../../src/validation/au
1010export default function RegisterScreen ( ) {
1111 const router = useRouter ( )
1212 const setToken = useAuthStore ( ( state ) => state . setToken )
13+
1314 const {
1415 control,
1516 handleSubmit,
@@ -46,6 +47,7 @@ export default function RegisterScreen() {
4647 < Typography variant = "body" color = { colors . muted } >
4748 Create your account to start discovering meals instantly.
4849 </ Typography >
50+
4951 < Controller
5052 control = { control }
5153 name = "fullName"
@@ -61,6 +63,7 @@ export default function RegisterScreen() {
6163 />
6264 ) }
6365 />
66+
6467 < Controller
6568 control = { control }
6669 name = "email"
@@ -79,24 +82,33 @@ export default function RegisterScreen() {
7982 />
8083 ) }
8184 />
85+
8286 < Controller
8387 control = { control }
8488 name = "password"
8589 render = { ( { field : { onChange, onBlur, value } } ) => (
86- < Input
87- label = "Password"
88- placeholder = "Minimum 8 characters"
89- secureTextEntry
90- autoCapitalize = "none"
91- autoComplete = "password-new"
92- textContentType = "newPassword"
93- value = { value }
94- onChangeText = { onChange }
95- onBlur = { onBlur }
96- error = { errors . password ?. message }
97- />
90+ < >
91+ < Input
92+ label = "Password"
93+ placeholder = "Minimum 8 characters"
94+ secureTextEntry
95+ autoCapitalize = "none"
96+ autoComplete = "password-new"
97+ textContentType = "newPassword"
98+ value = { value }
99+ onChangeText = { onChange }
100+ onBlur = { onBlur }
101+ error = { errors . password ?. message }
102+ />
103+ { ! errors . password ?. message ? (
104+ < Typography variant = "caption" color = { colors . muted } >
105+ Minimum 8 characters
106+ </ Typography >
107+ ) : null }
108+ </ >
98109 ) }
99110 />
111+
100112 < Controller
101113 control = { control }
102114 name = "confirmPassword"
@@ -113,6 +125,7 @@ export default function RegisterScreen() {
113125 />
114126 ) }
115127 />
128+
116129 < Button label = "Sign Up" loading = { isSubmitting } onPress = { handleSubmit ( onSubmit ) } />
117130 < Link href = "/(auth)/login" > Back To Login</ Link >
118131 </ ScrollView >
0 commit comments