We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 451a793 commit 1ef3ec6Copy full SHA for 1ef3ec6
src/index.tsx
@@ -19,8 +19,8 @@ type Props = {
19
20
const ReactInputVerificationCode = ({
21
length = 4,
22
- onChange,
23
- onCompleted,
+ onChange = () => {},
+ onCompleted = () => {},
24
placeholder = '·',
25
value: pValue,
26
}: Props) => {
@@ -141,11 +141,9 @@ const ReactInputVerificationCode = ({
141
React.useEffect(() => {
142
const stringValue = value.join('')
143
144
- if (typeof onChange === "function") {
145
- onChange(stringValue);
146
- }
+ onChange(stringValue);
147
148
- if (!stringValue.includes(placeholder) && typeof onCompleted === "function") {
+ if (!stringValue.includes(placeholder)) {
149
onCompleted(stringValue)
150
}
151
}, [value]);
0 commit comments