Skip to content

Commit 11bdb77

Browse files
authored
Merge pull request #47 from AldeonMoriak/patch-1
fix pasting string started with number
2 parents 4ab5905 + 7f798c2 commit 11bdb77

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
@@ -144,7 +144,7 @@ const ReactInputVerificationCode = ({
144144
const pastedString = e.clipboardData?.getData('text');
145145
if (!pastedString) return;
146146

147-
const isNumber = !Number.isNaN(+pastedString);
147+
const isNumber = /^\d+$/.test(pastedString);
148148
if (isNumber) setValue(pastedString.split('').slice(0, length));
149149
};
150150

0 commit comments

Comments
 (0)