Skip to content

Commit 47eb2b4

Browse files
Fix offline view of confirmation step
1 parent 300a666 commit 47eb2b4

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/pages/settings/Wallet/InternationalDepositAccount/substeps/Confirmation.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ScrollView from '@components/ScrollView';
1010
import Text from '@components/Text';
1111
import TextLink from '@components/TextLink';
1212
import useLocalize from '@hooks/useLocalize';
13+
import useNetwork from '@hooks/useNetwork';
1314
import useThemeStyles from '@hooks/useThemeStyles';
1415
import type {CustomSubStepProps} from '@pages/settings/Wallet/InternationalDepositAccount/types';
1516
import * as BankAccounts from '@userActions/BankAccounts';
@@ -18,6 +19,14 @@ import ONYXKEYS from '@src/ONYXKEYS';
1819

1920
const STEP_INDEXES = CONST.CORPAY_FIELDS.INDEXES.MAPPING;
2021

22+
type MenuItemProps = {
23+
description: string;
24+
title: string;
25+
shouldShowRightIcon: boolean;
26+
onPress: () => void;
27+
interactive?: boolean;
28+
};
29+
2130
function TermsAndConditionsLabel() {
2231
const {translate} = useLocalize();
2332
return (
@@ -34,6 +43,7 @@ function Confirmation({onNext, onMove, formValues, fieldsMap}: CustomSubStepProp
3443
const [isSubmitting, setIsSubmitting] = useState(false);
3544
const [error, setError] = useState('');
3645
const [corpayFields] = useOnyx(ONYXKEYS.CORPAY_FIELDS);
46+
const {isOffline} = useNetwork();
3747

3848
const getDataAndGoToNextStep = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.INTERNATIONAL_BANK_ACCOUNT_FORM>) => {
3949
setError('');
@@ -55,22 +65,24 @@ function Confirmation({onNext, onMove, formValues, fieldsMap}: CustomSubStepProp
5565
});
5666
};
5767

58-
const summaryItems = [
68+
const summaryItems: MenuItemProps[] = [
5969
{
6070
description: translate('common.country'),
6171
title: formValues.bankCountry,
62-
shouldShowRightIcon: true,
72+
shouldShowRightIcon: !isOffline,
6373
onPress: () => {
6474
onMove(STEP_INDEXES.COUNTRY_SELECTOR);
6575
},
76+
interactive: !isOffline,
6677
},
6778
{
6879
description: translate('common.currency'),
6980
title: formValues.bankCurrency,
70-
shouldShowRightIcon: true,
81+
shouldShowRightIcon: !isOffline,
7182
onPress: () => {
7283
onMove(STEP_INDEXES.BANK_ACCOUNT_DETAILS);
7384
},
85+
interactive: !isOffline,
7486
},
7587
];
7688

@@ -145,13 +157,14 @@ function Confirmation({onNext, onMove, formValues, fieldsMap}: CustomSubStepProp
145157
<ScrollView contentContainerStyle={styles.flexGrow1}>
146158
<Text style={[styles.textHeadlineLineHeightXXL, styles.ph5, styles.mb3]}>{translate('addPersonalBankAccount.confirmationStepHeader')}</Text>
147159
<Text style={[styles.mb6, styles.ph5, styles.textSupporting]}>{translate('addPersonalBankAccount.confirmationStepSubHeader')}</Text>
148-
{summaryItems.map(({description, title, shouldShowRightIcon, onPress}) => (
160+
{summaryItems.map(({description, title, shouldShowRightIcon, interactive, onPress}) => (
149161
<MenuItemWithTopDescription
150162
key={`${title}_${description}`}
151163
description={description}
152164
title={title}
153165
shouldShowRightIcon={shouldShowRightIcon}
154166
onPress={onPress}
167+
interactive={interactive}
155168
/>
156169
))}
157170
<FormProvider

0 commit comments

Comments
 (0)