Skip to content

Commit

Permalink
Merge pull request #7090 from Enragedsaturday/main
Browse files Browse the repository at this point in the history
Remove didMount to stop auto focus on PasswordForm
  • Loading branch information
marcochavezf authored Jan 13, 2022
2 parents a5fbe80 + 1417a78 commit 13b7b0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/signin/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LoginForm extends React.Component {
}

componentDidMount() {
if (!canFocusInputOnScreenFocus() || !this.input) {
if (!canFocusInputOnScreenFocus() || !this.input || !this.props.isVisible) {
return;
}
this.input.focus();
Expand Down
3 changes: 2 additions & 1 deletion src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import compose from '../../libs/compose';
import TextInput from '../../components/TextInput';
import * as ComponentUtils from '../../libs/ComponentUtils';
import withToggleVisibilityView, {toggleVisibilityViewPropTypes} from '../../components/withToggleVisibilityView';
import canFocusInputOnScreenFocus from '../../libs/canFocusInputOnScreenFocus';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -55,7 +56,7 @@ class PasswordForm extends React.Component {
}

componentDidMount() {
if (!this.input) {
if (!canFocusInputOnScreenFocus() || !this.input || !this.props.isVisible) {
return;
}
this.input.focus();
Expand Down

0 comments on commit 13b7b0b

Please sign in to comment.