From 1717d0b503911ae685ee1c34c294266daeb00d11 Mon Sep 17 00:00:00 2001
From: Mahyar Khanbolooki
Date: Wed, 2 Jul 2025 01:03:24 +0330
Subject: [PATCH] add: auto focus to password and otp fields
---
src/components/input/MultiInputField.tsx | 3 ++-
src/features/auth/components/StepEnterOtp.tsx | 1 +
src/features/auth/components/StepEnterPassword.tsx | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/components/input/MultiInputField.tsx b/src/components/input/MultiInputField.tsx
index 1102e0b..4d08360 100644
--- a/src/components/input/MultiInputField.tsx
+++ b/src/components/input/MultiInputField.tsx
@@ -12,7 +12,7 @@ type Props = {
} & Omit, "id">;
-function OTPInputField({ onChange, maxLength = 6, htmlFor, labelText, className, value = '', ...restProps }: Props) {
+function OTPInputField({ onChange, maxLength = 6, htmlFor, labelText, className, autoFocus, value = '', ...restProps }: Props) {
const values = value?.toString().split('').slice(0, maxLength);
const inputRefs = useRef(Array.from({ length: maxLength }, () => createRef()));
const [prevLength, setPrevLength] = useState(0);
@@ -58,6 +58,7 @@ function OTPInputField({ onChange, maxLength = 6, htmlFor, labelText, className,
{inputRefs?.current?.map((ref, i) => {
return (
کد ۶ رقمی ارسال شده به شماره {phoneNumber} را وارد نمایید.
کلمه عبور خود را وارد نمایید.