Skip to content

Commit

Permalink
Merge pull request #31698 from ZhenjaHorbach/login-auto-fill-list-app…
Browse files Browse the repository at this point in the history
…ears-if-click-on-Sign-in-here

Login-Auto-fill list appears if click on Sign in here
  • Loading branch information
marcaaron authored Dec 1, 2023
2 parents f72f629 + d2cb714 commit 6301426
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pages/signin/LoginForm/BaseLoginForm.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useIsFocused} from '@react-navigation/native';
import {parsePhoneNumber} from 'awesome-phonenumber';
import Str from 'expensify-common/lib/str';
import PropTypes from 'prop-types';
Expand All @@ -14,7 +15,6 @@ import GoogleSignIn from '@components/SignInButtons/GoogleSignIn';
import Text from '@components/Text';
import TextInput from '@components/TextInput';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withNavigationFocus from '@components/withNavigationFocus';
import withToggleVisibilityView from '@components/withToggleVisibilityView';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import usePrevious from '@hooks/usePrevious';
Expand Down Expand Up @@ -75,9 +75,6 @@ const propTypes = {

isVisible: PropTypes.bool.isRequired,

/** Whether navigation is focused */
isFocused: PropTypes.bool.isRequired,

...windowDimensionsPropTypes,

...withLocalizePropTypes,
Expand All @@ -101,6 +98,7 @@ function LoginForm(props) {
const [formError, setFormError] = useState(false);
const prevIsVisible = usePrevious(props.isVisible);
const firstBlurred = useRef(false);
const isFocused = useIsFocused();

const {translate} = props;

Expand Down Expand Up @@ -204,10 +202,11 @@ function LoginForm(props) {
useEffect(() => {
// Just call clearAccountMessages on the login page (home route), because when the user is in the transition route and not yet authenticated,
// this component will also be mounted, resetting account.isLoading will cause the app to briefly display the session expiration page.
if (props.isFocused && props.isVisible) {

if (isFocused && props.isVisible) {
Session.clearAccountMessages();
}
if (!canFocusInputOnScreenFocus() || !input.current || !props.isVisible) {
if (!canFocusInputOnScreenFocus() || !input.current || !props.isVisible || !isFocused) {
return;
}
let focusTimeout;
Expand Down Expand Up @@ -346,7 +345,6 @@ const LoginFormWithRef = forwardRef((props, ref) => (
LoginFormWithRef.displayName = 'LoginFormWithRef';

export default compose(
withNavigationFocus,
withOnyx({
account: {key: ONYXKEYS.ACCOUNT},
credentials: {key: ONYXKEYS.CREDENTIALS},
Expand Down

0 comments on commit 6301426

Please sign in to comment.