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

disable "Didn't receive magic code" while loading #26783

Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function BaseValidateCodeForm(props) {
const loginData = props.loginList[props.contactMethod];
const inputValidateCodeRef = useRef();
const validateLoginError = ErrorUtils.getEarliestErrorField(loginData, 'validateLogin');
const shouldDisableDidntReceiveMagicCode = props.network.isOffline || props.account.isLoading;
c3024 marked this conversation as resolved.
Show resolved Hide resolved

useImperativeHandle(props.innerRef, () => ({
focus() {
Expand Down Expand Up @@ -170,7 +171,7 @@ function BaseValidateCodeForm(props) {
>
<View style={[styles.mt2, styles.dFlex, styles.flexColumn, styles.alignItemsStart]}>
<PressableWithFeedback
disabled={props.network.isOffline}
disabled={shouldDisableDidntReceiveMagicCode}
c3024 marked this conversation as resolved.
Show resolved Hide resolved
style={[styles.mr1]}
onPress={resendValidateCode}
underlayColor={themeColors.componentBG}
Expand All @@ -179,7 +180,7 @@ function BaseValidateCodeForm(props) {
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
accessibilityLabel={props.translate('validateCodeForm.magicCodeNotReceived')}
>
<Text style={[StyleUtils.getDisabledLinkStyles(props.network.isOffline)]}>{props.translate('validateCodeForm.magicCodeNotReceived')}</Text>
<Text style={[StyleUtils.getDisabledLinkStyles(shouldDisableDidntReceiveMagicCode)]}>{props.translate('validateCodeForm.magicCodeNotReceived')}</Text>
c3024 marked this conversation as resolved.
Show resolved Hide resolved
</PressableWithFeedback>
{props.hasMagicCodeBeenSent && (
<DotIndicatorMessage
Expand Down
5 changes: 3 additions & 2 deletions src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function BaseValidateCodeForm(props) {

const hasError = Boolean(props.account) && !_.isEmpty(props.account.errors);
const isLoadingResendValidationForm = props.account.loadingForm === CONST.FORMS.RESEND_VALIDATE_CODE_FORM;
const shouldDisableDidntReceiveMagicCode = props.network.isOffline || props.account.isLoading;
c3024 marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
if (!(inputValidateCodeRef.current && hasError && (props.session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || props.account.isLoading))) {
Expand Down Expand Up @@ -279,13 +280,13 @@ function BaseValidateCodeForm(props) {
style={[styles.mt2]}
onPress={resendValidateCode}
underlayColor={themeColors.componentBG}
disabled={props.network.isOffline}
disabled={shouldDisableDidntReceiveMagicCode}
c3024 marked this conversation as resolved.
Show resolved Hide resolved
hoverDimmingValue={1}
pressDimmingValue={0.2}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
accessibilityLabel={props.translate('validateCodeForm.magicCodeNotReceived')}
>
<Text style={[StyleUtils.getDisabledLinkStyles(props.network.isOffline)]}>
<Text style={[StyleUtils.getDisabledLinkStyles(shouldDisableDidntReceiveMagicCode)]}>
c3024 marked this conversation as resolved.
Show resolved Hide resolved
{hasError ? props.translate('validateCodeForm.requestNewCodeAfterErrorOccurred') : props.translate('validateCodeForm.magicCodeNotReceived')}
</Text>
</PressableWithFeedback>
Expand Down
Loading