Skip to content

Commit

Permalink
Merge pull request #12992 from Expensify/alberto-focusError
Browse files Browse the repository at this point in the history
Fix console error on focus
  • Loading branch information
Julesssss authored Nov 29, 2022
2 parents 20c9936 + edf41c4 commit a46213d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ class Form extends React.Component {
onFixTheErrorsLinkPressed={() => {
const errors = !_.isEmpty(this.state.errors) ? this.state.errors : this.props.formState.errorFields;
const focusKey = _.find(_.keys(this.inputRefs), key => _.keys(errors).includes(key));
this.inputRefs[focusKey].focus();
const focusInput = this.inputRefs[focusKey];
if (focusInput.focus && typeof focusInput.focus === 'function') {
focusInput.focus();
}
}}
containerStyles={[styles.mh0, styles.mt5]}
enabledWhenOffline={this.props.enabledWhenOffline}
Expand Down

0 comments on commit a46213d

Please sign in to comment.