Skip to content

Commit c48d2ff

Browse files
authored
Merge pull request #23 from LukeWlodarczyk/fix/paste
fix: slice pasted string in order to match verifcation code length
2 parents c68641a + 5d161aa commit c48d2ff

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)