From 1cd500e05588907cbe929e3a91aa1606560b616c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 24 Oct 2024 12:39:32 +0800 Subject: [PATCH] don't dismiss modal after upgrade for approval case --- .../workspace/upgrade/WorkspaceUpgradePage.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx index a8c9705663d4..2a744ce4bd2d 100644 --- a/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx +++ b/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx @@ -37,11 +37,19 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { return; } switch (feature.id) { + case CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id: + Navigation.goBack(); + if (route.params.backTo) { + Navigation.navigate(route.params.backTo); + } + return; case CONST.UPGRADE_FEATURE_INTRO_MAPPING.reportFields.id: case CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id: case CONST.UPGRADE_FEATURE_INTRO_MAPPING.companyCards.id: + Navigation.dismissModal(); return Navigation.navigate(ROUTES.WORKSPACE_MORE_FEATURES.getRoute(policyID)); default: + Navigation.dismissModal(); return route.params.backTo ? Navigation.navigate(route.params.backTo) : Navigation.goBack(); } }, [feature, policyID, route.params.backTo]); @@ -51,7 +59,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { return; } - Policy.upgradeToCorporate(policy.id, feature.name); + Policy.upgradeToCorporate(policy.id, feature?.name); }; const confirmUpgrade = useCallback(() => { @@ -97,7 +105,6 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { title={translate('common.upgrade')} onBackButtonPress={() => { if (isUpgraded) { - Navigation.dismissModal(); goBack(); } else { Navigation.goBack(); @@ -106,10 +113,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { /> {isUpgraded && ( { - Navigation.dismissModal(); - goBack(); - }} + onConfirmUpgrade={goBack} policyName={policy.name} /> )}