Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor autofocus set after changing the currency on request/split money screen #5267

Merged
merged 2 commits into from
Oct 20, 2021
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
16 changes: 15 additions & 1 deletion src/pages/iou/steps/IOUAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,28 @@ class IOUAmountPage extends React.Component {
this.updateAmountNumberPad = this.updateAmountNumberPad.bind(this);
this.updateAmount = this.updateAmount.bind(this);
this.stripCommaFromAmount = this.stripCommaFromAmount.bind(this);
this.focusTextInput = this.focusTextInput.bind(this);

this.state = {
amount: props.selectedAmount,
};
}

componentDidMount() {
// Component is not initialized yet due to navigation transitions
this.focusTextInput();
}

componentDidUpdate(prevProps) {
if (this.props.iou.selectedCurrencyCode !== prevProps.iou.selectedCurrencyCode) {
this.focusTextInput();
}
}

/**
* Focus text input
*/
focusTextInput() {
// Component may not initialized due to navigation transitions
// Wait until interactions are complete before trying to focus
InteractionManager.runAfterInteractions(() => {
// Focus text input
Expand Down