1- import {
2- View ,
3- Text ,
4- TextInput ,
5- StyleSheet ,
6- Pressable ,
7- } from "react-native" ;
8- import { SafeAreaView } from "react-native-safe-area-context" ;
9- import { useState } from "react" ;
10- import { useRouter } from "expo-router" ;
11- import { verifyOtp } from "@/services/auth/otp.service" ;
12- import { useLocalSearchParams } from "expo-router/build/hooks" ;
1+ import { View , Text , TextInput , StyleSheet , Pressable } from 'react-native' ;
2+ import { SafeAreaView } from 'react-native-safe-area-context' ;
3+ import { useState } from 'react' ;
4+ import { useRouter } from 'expo-router' ;
5+ import { verifyOtp } from '@/services/auth/otp.service' ;
6+ import { useLocalSearchParams } from 'expo-router/build/hooks' ;
137
148export default function OtpScreen ( ) {
15- const [ otp , setOtp ] = useState ( "" ) ;
9+ const [ otp , setOtp ] = useState ( '' ) ;
1610 const [ loading , setLoading ] = useState ( false ) ;
1711 const router = useRouter ( ) ;
1812 const { phone } = useLocalSearchParams ( ) ;
@@ -27,10 +21,10 @@ export default function OtpScreen() {
2721 if ( ! res ?. success ) return ;
2822
2923 if ( res . userExists ) {
30- router . replace ( " /(tabs)/home" ) ;
24+ router . replace ( ' /(tabs)/home' ) ;
3125 } else {
3226 router . replace ( {
33- pathname : " /(auth)/register" ,
27+ pathname : ' /(auth)/register' ,
3428 params : {
3529 otpId : res . otpId ,
3630 phoneNumber : phone . toString ( ) ,
@@ -46,10 +40,8 @@ export default function OtpScreen() {
4640 < Text style = { styles . title } > Enter OTP</ Text >
4741
4842 < Text style = { styles . description } >
49- We’ve sent a one-time password to{ " " }
50- < Text style = { styles . phone } >
51- { phone }
52- </ Text >
43+ We’ve sent a one-time password to{ ' ' }
44+ < Text style = { styles . phone } > { phone } </ Text >
5345 </ Text >
5446
5547 < TextInput
@@ -65,20 +57,18 @@ export default function OtpScreen() {
6557 < Pressable
6658 style = { [
6759 styles . button ,
68- ( otp . length < 4 || loading ) &&
69- styles . buttonDisabled ,
60+ ( otp . length < 4 || loading ) && styles . buttonDisabled ,
7061 ] }
7162 onPress = { handleVerify }
7263 disabled = { otp . length < 4 || loading }
7364 >
7465 < Text style = { styles . buttonText } >
75- { loading ? " Verifying..." : " Verify OTP" }
66+ { loading ? ' Verifying...' : ' Verify OTP' }
7667 </ Text >
7768 </ Pressable >
7869
7970 < Text style = { styles . resend } >
80- Didn’t receive OTP?{ " " }
81- < Text style = { styles . resendLink } > Resend</ Text >
71+ Didn’t receive OTP? < Text style = { styles . resendLink } > Resend</ Text >
8272 </ Text >
8373 </ View >
8474 </ View >
@@ -88,7 +78,7 @@ export default function OtpScreen() {
8878const styles = StyleSheet . create ( {
8979 safeArea : {
9080 flex : 1 ,
91- backgroundColor : " #EAF5EC" ,
81+ backgroundColor : ' #EAF5EC' ,
9282 } ,
9383
9484 container : {
@@ -98,30 +88,30 @@ const styles = StyleSheet.create({
9888
9989 content : {
10090 flex : 1 ,
101- justifyContent : " center" ,
91+ justifyContent : ' center' ,
10292 } ,
10393
10494 title : {
10595 fontSize : 24 ,
106- fontWeight : " 700" ,
107- color : " #111" ,
96+ fontWeight : ' 700' ,
97+ color : ' #111' ,
10898 marginBottom : 8 ,
10999 } ,
110100
111101 description : {
112102 fontSize : 14 ,
113- color : " #555" ,
103+ color : ' #555' ,
114104 lineHeight : 20 ,
115105 marginBottom : 32 ,
116106 } ,
117107
118108 phone : {
119- fontWeight : " 600" ,
120- color : " #111" ,
109+ fontWeight : ' 600' ,
110+ color : ' #111' ,
121111 } ,
122112
123113 otpInput : {
124- backgroundColor : " #FFF" ,
114+ backgroundColor : ' #FFF' ,
125115 borderRadius : 16 ,
126116 height : 56 ,
127117 fontSize : 20 ,
@@ -130,10 +120,10 @@ const styles = StyleSheet.create({
130120 } ,
131121
132122 button : {
133- backgroundColor : " #000" ,
123+ backgroundColor : ' #000' ,
134124 paddingVertical : 16 ,
135125 borderRadius : 16 ,
136- alignItems : " center" ,
126+ alignItems : ' center' ,
137127 marginBottom : 16 ,
138128 } ,
139129
@@ -142,19 +132,19 @@ const styles = StyleSheet.create({
142132 } ,
143133
144134 buttonText : {
145- color : " #FFF" ,
135+ color : ' #FFF' ,
146136 fontSize : 16 ,
147- fontWeight : " 600" ,
137+ fontWeight : ' 600' ,
148138 } ,
149139
150140 resend : {
151- textAlign : " center" ,
141+ textAlign : ' center' ,
152142 fontSize : 13 ,
153- color : " #555" ,
143+ color : ' #555' ,
154144 } ,
155145
156146 resendLink : {
157- fontWeight : " 600" ,
158- color : " #000" ,
147+ fontWeight : ' 600' ,
148+ color : ' #000' ,
159149 } ,
160150} ) ;
0 commit comments