Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class OtpInput extends Component<Props, State> {
handleOnPaste = (e: Object) => {
e.preventDefault();
const { numInputs } = this.props;
const { activeInput } = this.state;
var { activeInput } = this.state;
const otp = this.getOtpValue();

// Get pastedData in an array of max size (num of inputs - current position)
Expand All @@ -197,9 +197,13 @@ class OtpInput extends Component<Props, State> {
for (let pos = 0; pos < numInputs; ++pos) {
if (pos >= activeInput && pastedData.length > 0) {
otp[pos] = pastedData.shift();
activeInput++;
}
}

this.setState({ activeInput });
this.focusInput(activeInput);

this.handleOtpChange(otp);
};

Expand Down