Skip to content

Commit 5d161aa

Browse files
fix: slice pasted string in order to match verifcation code length
1 parent c68641a commit 5d161aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const ReactInputVerificationCode = ({
140140
if (!pastedString) return;
141141

142142
const isNumber = !Number.isNaN(+pastedString);
143-
if (isNumber) setValue(pastedString.split(''));
143+
if (isNumber) setValue(pastedString.split('').slice(0, length));
144144
};
145145

146146
codeInput.addEventListener('paste', onPaste);

0 commit comments

Comments
 (0)