Skip to content

Commit 6c58651

Browse files
fix: Disable Continue Button In Login Page (#18)
* fix: Disable Continue Button In Login Page * fix: Disabled Name If Name Is Not Provided * fix: Before Disabling Continue Button Validating Name In Login Page --------- Co-authored-by: Mohammed Fabinsha <fabinsha13@gmail.com>
1 parent 25b1529 commit 6c58651

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

audire/audire-mobile-app/src/modules/login/LoginForm.tsx

+16-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const LoginForm = () => {
2525
if (!isNewUser) {
2626
const r = await trigger({ mobile: `+91${mobileNumber}` });
2727
setIsNewUser(r.isNewUser);
28-
setMobileNumber(r.mobile);
28+
setMobileNumber(r.mobile.substring(2));
2929
if (!r.isNewUser) {
3030
router.replace({
3131
pathname: 'verification',
@@ -43,7 +43,7 @@ const LoginForm = () => {
4343
router.push({
4444
pathname: 'verification',
4545
params: {
46-
mobile: mobileNumber,
46+
mobile: `91${mobileNumber}`,
4747
fullName: fullName,
4848
isNewUser: 1,
4949
},
@@ -54,10 +54,19 @@ const LoginForm = () => {
5454
}
5555
};
5656

57+
const isValid =
58+
mobileNumber.length === 10 && (!isNewUser || fullName.length > 0);
59+
5760
return (
58-
<Box display="flex" flex={1} justifyContent="center" w="$full" alignItems='center'>
59-
<Box bg="$white" py="$5" px="$5" $base-w="$full" $md-w="45%" $xl-w="25%">
60-
<Box mb="$9" alignSelf='flex-start'>
61+
<Box
62+
display="flex"
63+
flex={1}
64+
justifyContent="center"
65+
w="$full"
66+
alignItems="center"
67+
>
68+
<Box bg="$white" py="$5" px="$5" $base-w="$full" $md-w="45%" $xl-w="25%">
69+
<Box mb="$9" alignSelf="flex-start">
6170
<Text fontSize="$xl" color="black" fontWeight="bold">
6271
Welcome to
6372
</Text>
@@ -119,14 +128,15 @@ const LoginForm = () => {
119128
</Input>
120129
</FormControl>
121130
) : null}
122-
<Box mb="$1" w="$full">
131+
<Box mb="$1" w="$full" opacity={isValid ? 1 : 0.7}>
123132
<Button
124133
variant="solid"
125134
mt="$1"
126135
bg="#B051AE"
127136
onPress={() => {
128137
handleTrigger();
129138
}}
139+
disabled={!isValid}
130140
>
131141
{isTriggeringMobileOTP ? (
132142
<ActivityIndicator size="small" color="#ffffff" />

0 commit comments

Comments
 (0)