File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-otp-input" ,
3
- "version" : " 0.3.2 " ,
3
+ "version" : " 0.3.3 " ,
4
4
"description" : " A fully customizable, one-time password input component for the web built with React" ,
5
5
"main" : " lib/index.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -132,7 +132,9 @@ class OtpInput extends Component<Props, State> {
132
132
133
133
// Helper to return OTP from input
134
134
getOtp = ( ) => {
135
- this . props . onChange ( this . state . otp . join ( '' ) ) ;
135
+ const { onChange, isInputNum } = this . props ;
136
+ const otp = this . state . otp . join ( '' ) ;
137
+ onChange ( isInputNum ? Number ( otp ) : otp ) ;
136
138
} ;
137
139
138
140
// Focus on input by index
@@ -160,7 +162,7 @@ class OtpInput extends Component<Props, State> {
160
162
// Change OTP value at focused input
161
163
changeCodeAtFocus = ( value : string ) => {
162
164
const { activeInput, otp } = this . state ;
163
- otp [ activeInput ] = value ;
165
+ otp [ activeInput ] = value [ 0 ] ;
164
166
165
167
this . setState ( {
166
168
otp,
You can’t perform that action at this time.
0 commit comments