diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index 239c85a..6413daa 100644 --- a/components/ConfirmationCodeInput.js +++ b/components/ConfirmationCodeInput.js @@ -195,9 +195,15 @@ export default class ConfirmationCodeInput extends Component { _onKeyPress(e) { if (e.nativeEvent.key === 'Backspace') { + // Return if duration between previous key press and backspace is less than 20ms + if (Math.abs(this.lastKeyEventTimestamp - e.timeStamp) < 20) return; + const { currentIndex } = this.state; const nextIndex = currentIndex > 0 ? currentIndex - 1 : 0; this._setFocus(nextIndex); + } else { + // Record non-backspace key event time stamp + this.lastKeyEventTimestamp = e.timeStamp; } }