Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 1 addition & 5 deletions src/components/MagicCodeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ type MagicCodeInputProps = {

/** TestID for test */
testID?: string;

/** Whether to allow auto submit again after the previous attempt fails */
allowResubmit?: boolean;
};

type MagicCodeInputHandle = {
Expand Down Expand Up @@ -108,7 +105,6 @@ function MagicCodeInput(
autoComplete,
hasError = false,
testID = '',
allowResubmit = false,
}: MagicCodeInputProps,
ref: ForwardedRef<MagicCodeInputHandle>,
) {
Expand Down Expand Up @@ -179,7 +175,7 @@ function MagicCodeInput(
const validateAndSubmit = () => {
const numbers = decomposeString(value, maxLength);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if ((wasSubmitted && !allowResubmit) || !shouldSubmitOnComplete || numbers.filter((n) => isNumeric(n)).length !== maxLength || isOffline) {
if (wasSubmitted || !shouldSubmitOnComplete || numbers.filter((n) => isNumeric(n)).length !== maxLength || isOffline) {
return;
}
if (!wasSubmitted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ type ValidateCodeFormProps = {
/** Whether the form is loading or not */
isLoading?: boolean;

/** Whether to allow auto submit again after the previous attempt fails */
allowResubmit?: boolean;

/** Whether to show skip button */
shouldShowSkipButton?: boolean;

Expand All @@ -104,7 +101,6 @@ function BaseValidateCodeForm({
hideSubmitButton,
submitButtonText,
isLoading,
allowResubmit,
shouldShowSkipButton = false,
handleSkipButtonPress,
}: ValidateCodeFormProps) {
Expand Down Expand Up @@ -271,7 +267,6 @@ function BaseValidateCodeForm({
hasError={canShowError && !isEmptyObject(finalValidateError)}
onFulfill={validateAndSubmitForm}
autoFocus={false}
allowResubmit={allowResubmit}
/>
{shouldShowTimer && (
<Text style={[styles.mt5]}>
Expand Down Expand Up @@ -327,6 +322,7 @@ function BaseValidateCodeForm({
<Button
text={translate('common.skip')}
onPress={handleSkipButtonPress}
style={[styles.mt4]}
success={false}
large
/>
Expand Down
24 changes: 10 additions & 14 deletions src/pages/OnboardingPrivateDomain/BaseOnboardingPrivateDomain.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {useCallback, useEffect, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import ValidateCodeForm from '@components/ValidateCodeActionModal/ValidateCodeForm';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -70,8 +70,11 @@ function BaseOnboardingPrivateDomain({shouldUseNativeStyles, route}: BaseOnboard
progressBarPercentage={40}
onBackButtonPress={Navigation.goBack}
/>
<View style={[styles.flex1, onboardingIsMediumOrLargerScreenWidth && styles.mt5, onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5, styles.justifyContentBetween]}>
<View style={[styles.flexGrow1, styles.mb5]}>
<ScrollView
style={[styles.w100, styles.h100, styles.flex1]}
contentContainerStyle={styles.flexGrow1}
>
<View style={[styles.mb5, onboardingIsMediumOrLargerScreenWidth && styles.mt5, onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5, styles.flex1]}>
<Text style={styles.textHeadlineH1}>{translate('onboarding.peopleYouMayKnow')}</Text>
<Text style={[styles.textAlignLeft, styles.mt5]}>{translate('onboarding.workspaceYouMayJoin', {domain, email})}</Text>
<ValidateCodeForm
Expand All @@ -85,22 +88,15 @@ function BaseOnboardingPrivateDomain({shouldUseNativeStyles, route}: BaseOnboard
setHasMagicCodeBeenSent(true);
}}
clearError={() => clearGetAccessiblePoliciesErrors()}
hideSubmitButton
validateError={getAccessiblePoliciesAction?.errors}
hasMagicCodeBeenSent={hasMagicCodeBeenSent}
allowResubmit
/>
</View>
<View style={[styles.mb5]}>
<Button
success={false}
large
text={translate('common.skip')}
shouldShowSkipButton
handleSkipButtonPress={() => Navigation.navigate(ROUTES.ONBOARDING_PURPOSE.getRoute(route.params?.backTo))}
buttonStyles={[styles.flex2, styles.justifyContentEnd]}
isLoading={getAccessiblePoliciesAction?.loading}
onPress={() => Navigation.navigate(ROUTES.ONBOARDING_PURPOSE.getRoute(route.params?.backTo))}
/>
</View>
</View>
</ScrollView>
</ScreenWrapper>
);
}
Expand Down