@@ -120,28 +120,16 @@ const ReactInputVerificationCode = ({
120
120
index : number
121
121
) => {
122
122
const eventValue = event . target . value ;
123
- /**
124
- * ensure we only display 1 character in the input
125
- * by clearing the already setted value
126
- */
127
- const value = eventValue . replace ( values [ index ] , '' ) ;
128
-
129
- /**
130
- * if the value is not valid, don't go any further
131
- * and select the content of the input for a better UX
132
- */
133
- if ( ! validate ( value ) ) {
134
- selectInputContent ( index ) ;
135
- return ;
136
- }
137
-
138
- console . log ( 'RIVC: onInputChange:eventValue' , eventValue ) ;
139
- console . log ( 'RIVC: onInputChange:value' , value ) ;
123
+ console . log (
124
+ 'RIVC: onInputChange:eventValue' ,
125
+ eventValue ,
126
+ eventValue . length
127
+ ) ;
140
128
141
129
/**
142
130
* otp code
143
131
*/
144
- if ( value . length > 1 ) {
132
+ if ( eventValue . length > 1 ) {
145
133
console . log ( 'RIVC: isOtp' ) ;
146
134
147
135
console . log ( 'RIVC: fillValues(eventValue)' , fillValues ( eventValue ) ) ;
@@ -159,6 +147,23 @@ const ReactInputVerificationCode = ({
159
147
return ;
160
148
}
161
149
150
+ /**
151
+ * ensure we only display 1 character in the input
152
+ * by clearing the already setted value
153
+ */
154
+ const value = eventValue . replace ( values [ index ] , '' ) ;
155
+
156
+ /**
157
+ * if the value is not valid, don't go any further
158
+ * and select the content of the input for a better UX
159
+ */
160
+ if ( ! validate ( value ) ) {
161
+ selectInputContent ( index ) ;
162
+ return ;
163
+ }
164
+
165
+ console . log ( 'RIVC: onInputChange:value' , value ) ;
166
+
162
167
setValue ( value , index ) ;
163
168
164
169
/**
0 commit comments