Skip to content

Commit

Permalink
updated based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Feb 5, 2024
1 parent 4aa049a commit 944a29b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/pages/signin/LoginForm/BaseLoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {parsePhoneNumber} from '@libs/PhoneNumber';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ValidationUtils from '@libs/ValidationUtils';
import Visibility from '@libs/Visibility';
import willBlurTextInputOnTapOutside from '@libs/willBlurTextInputOnTapOutside';
import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside';
import * as CloseAccount from '@userActions/CloseAccount';
import * as MemoryOnlyKeys from '@userActions/MemoryOnlyKeys/MemoryOnlyKeys';
import * as Session from '@userActions/Session';
Expand Down Expand Up @@ -92,6 +92,8 @@ const defaultProps = {
isInModal: false,
};

const willBlurTextInputOnTapOutside = willBlurTextInputOnTapOutsideFunc();

function LoginForm(props) {
const styles = useThemeStyles();
const input = useRef();
Expand Down Expand Up @@ -282,17 +284,18 @@ function LoginForm(props) {
// As we have only two signin buttons (Apple/Google) other than the text input,
// for natives onBlur is called only when the buttons are pressed and we don't need
// to validate in those case as the user has opted for other signin flow.
willBlurTextInputOnTapOutside() &&
(() =>
// This delay is to avoid the validate being called before google iframe is rendered to
// avoid error message appearing after pressing google signin button.
setTimeout(() => {
if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) {
return;
}
firstBlurred.current = true;
validate(login);
}, 500))
willBlurTextInputOnTapOutside
? () =>
// This delay is to avoid the validate being called before google iframe is rendered to
// avoid error message appearing after pressing google signin button.
setTimeout(() => {
if (firstBlurred.current || !Visibility.isVisible() || !Visibility.hasFocus()) {
return;
}
firstBlurred.current = true;
validate(login);
}, 500)
: undefined
}
onChangeText={onTextInput}
onSubmitEditing={validateAndSubmitForm}
Expand Down

0 comments on commit 944a29b

Please sign in to comment.