diff --git a/src/pages/iou/steps/IOUAmountPage.js b/src/pages/iou/steps/IOUAmountPage.js index 5ebccbbcb6ee..fd415c7b6913 100755 --- a/src/pages/iou/steps/IOUAmountPage.js +++ b/src/pages/iou/steps/IOUAmountPage.js @@ -75,6 +75,7 @@ class IOUAmountPage extends React.Component { this.updateAmount = this.updateAmount.bind(this); this.stripCommaFromAmount = this.stripCommaFromAmount.bind(this); this.focusTextInput = this.focusTextInput.bind(this); + this.focusEmptyInput = this.focusEmptyInput.bind(this); this.state = { amount: props.selectedAmount, @@ -93,6 +94,16 @@ class IOUAmountPage extends React.Component { this.focusTextInput(); } + /** + * Keep TextInput focused if no amount is entered. + */ + focusEmptyInput() { + if (this.state.amount !== '') { + return; + } + this.textInput.focus(); + } + /** * Focus text input */ @@ -236,6 +247,7 @@ class IOUAmountPage extends React.Component { value={formattedAmount} placeholder={this.props.numberFormat(0)} keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD} + onBlur={this.focusEmptyInput} />