File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ export interface ReactInputVerificationCodeProps {
23
23
const ReactInputVerificationCode = ( {
24
24
autoFocus = false ,
25
25
length = 4 ,
26
- onChange = ( ) => { } ,
27
- onCompleted = ( ) => { } ,
26
+ onChange = ( ) => { } ,
27
+ onCompleted = ( ) => { } ,
28
28
placeholder = '·' ,
29
29
value : pValue ,
30
30
dataCy = 'verification-code' ,
@@ -156,7 +156,7 @@ const ReactInputVerificationCode = ({
156
156
const stringValue = value . join ( '' ) ;
157
157
const isCompleted = stringValue . length === length ;
158
158
159
- if ( isCompleted ) onCompleted ( stringValue ) ;
159
+ if ( isCompleted && stringValue !== emptyValue . join ( '' ) ) onCompleted ( stringValue ) ;
160
160
onChange ( stringValue ) ;
161
161
} , [ value , length ] ) ;
162
162
@@ -208,9 +208,8 @@ const ReactInputVerificationCode = ({
208
208
ref = { ref }
209
209
role = 'button'
210
210
tabIndex = { 0 }
211
- className = { `ReactInputVerificationCode__item ${
212
- value [ i ] !== placeholder ? 'is-filled' : ''
213
- } ${ i === activeIndex ? 'is-active' : '' } `}
211
+ className = { `ReactInputVerificationCode__item ${ value [ i ] !== placeholder ? 'is-filled' : ''
212
+ } ${ i === activeIndex ? 'is-active' : '' } `}
214
213
onFocus = { onItemFocus ( i ) }
215
214
data-cy = { `${ dataCy } -${ i } -item` }
216
215
>
You can’t perform that action at this time.
0 commit comments