Skip to content

Commit 8ed9c09

Browse files
authored
Merge pull request #60375 from mkzie2/mkzie2-issue/59794
fix: report virtual card page is open on top of wallet page
2 parents 4c5855b + 845b76c commit 8ed9c09

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/ROUTES.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ const ROUTES = {
247247
},
248248
SETTINGS_REPORT_FRAUD: {
249249
route: 'settings/wallet/card/:cardID/report-virtual-fraud',
250-
getRoute: (cardID: string) => `settings/wallet/card/${cardID}/report-virtual-fraud` as const,
250+
getRoute: (cardID: string, backTo?: string) => getUrlWithBackToParam(`settings/wallet/card/${cardID}/report-virtual-fraud`, backTo),
251251
},
252252
SETTINGS_REPORT_FRAUD_CONFIRMATION: {
253253
route: 'settings/wallet/card/:cardID/report-virtual-fraud-confirm',

src/libs/Navigation/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ type SettingsNavigatorParamList = {
135135
[SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: {
136136
/** cardID of selected card */
137137
cardID: string;
138+
backTo?: Routes;
138139
};
139140
[SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD_CONFIRMATION]: {
140141
/** cardID of selected card */

src/pages/settings/Wallet/ExpensifyCardPage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ function ExpensifyCardPage({
6565
params: {cardID = ''},
6666
},
6767
}: ExpensifyCardPageProps) {
68-
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
69-
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST);
70-
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST);
68+
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
69+
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: false});
70+
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
7171

7272
const styles = useThemeStyles();
7373
const {isOffline} = useNetwork();
@@ -247,7 +247,7 @@ function ExpensifyCardPage({
247247
titleStyle={styles.walletCardMenuItem}
248248
icon={Expensicons.Flag}
249249
shouldShowRightIcon
250-
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(String(card.cardID)))}
250+
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(String(card.cardID), Navigation.getActiveRoute()))}
251251
/>
252252
)}
253253
</>
@@ -292,7 +292,7 @@ function ExpensifyCardPage({
292292
titleStyle={styles.walletCardMenuItem}
293293
icon={Expensicons.Flag}
294294
shouldShowRightIcon
295-
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(String(card.cardID)))}
295+
onPress={() => Navigation.navigate(ROUTES.SETTINGS_REPORT_FRAUD.getRoute(String(card.cardID), Navigation.getActiveRoute()))}
296296
/>
297297
)}
298298
</>

src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ type ReportVirtualCardFraudPageProps = PlatformStackScreenProps<SettingsNavigato
2828

2929
function ReportVirtualCardFraudPage({
3030
route: {
31-
params: {cardID = ''},
31+
params: {cardID = '', backTo},
3232
},
3333
}: ReportVirtualCardFraudPageProps) {
3434
const styles = useThemeStyles();
3535
const {translate} = useLocalize();
36-
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST);
37-
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
38-
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST);
39-
const [formData] = useOnyx(ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD);
36+
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: false});
37+
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
38+
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
39+
const [formData] = useOnyx(ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD, {canBeMissing: true});
4040
const primaryLogin = account?.primaryLogin ?? '';
4141
const loginData = loginList?.[primaryLogin];
4242

@@ -102,7 +102,7 @@ function ReportVirtualCardFraudPage({
102102
<DelegateNoAccessWrapper accessDeniedVariants={[CONST.DELEGATE.DENIED_ACCESS_VARIANTS.DELEGATE]}>
103103
<HeaderWithBackButton
104104
title={translate('reportFraudPage.title')}
105-
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAINCARD.getRoute(cardID))}
105+
onBackButtonPress={() => Navigation.goBack(backTo)}
106106
/>
107107
<View style={[styles.flex1, styles.justifyContentBetween]}>
108108
<Text style={[styles.webViewStyles.baseFontStyle, styles.mh5]}>{translate('reportFraudPage.description')}</Text>

0 commit comments

Comments
 (0)