Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions audire/audire-mobile-app/src/modules/login/VerificationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ const VerificationView: FC<VerificationFormProps> = ({
});
};

const handleBackspace = (index: number) => {
const prevRef = inputRefs.current[index - 1];
prevRef?.current?.focus?.();
setOTPValues((prev) => {
prev[index - 1] = '';
return [...prev];
});
};

const handleResendOTP = () => {
triggerOTP({ mobile });
setResendCountdown(60);
Expand All @@ -112,16 +121,21 @@ const VerificationView: FC<VerificationFormProps> = ({
keyboardType="numeric"
onChangeText={(newValue) => handleOtpInputChange(index, newValue)}
maxLength={1}
onKeyPress={({ nativeEvent }) => {
if (nativeEvent.key === 'Backspace') {
handleBackspace(index);
}
}}
/>
));
};

return (
<Box display="flex" flex={1} justifyContent="center" w="$full">
<Box display="flex" mb="$6">
<Text fontSize="$2xl" fontWeight="bold" color="black" pl="$6">
<Text fontSize="$xl" fontWeight="bold" color="black" pl="$6">
Verify
<Text color="$fuchsia800" fontWeight="bold" fontSize="$2xl" ml="$1">
<Text color="$fuchsia800" fontWeight="bold" fontSize="$xl" ml="$1">
OTP
</Text>
</Text>
Expand Down