diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index dc83966b5956..f71a2e83af08 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -432,9 +432,11 @@ function AttachmentModal({ text: translate('common.replace'), onSelected: () => { closeModal(true); - Navigation.navigate( - ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction?.transactionID, report?.reportID, Navigation.getActiveRouteWithoutParams()), - ); + Navigation.isNavigationReady().then(() => { + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction?.transactionID, report?.reportID, Navigation.getActiveRouteWithoutParams()), + ); + }); }, }); } diff --git a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx index a2475ca3ec70..62e75f6895cd 100644 --- a/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx +++ b/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx @@ -70,7 +70,7 @@ function NewContactMethodPage({route}: NewContactMethodPageProps) { return; } - Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.route); + Navigation.goBack(ROUTES.SETTINGS_CONTACT_METHODS.route); User.clearUnvalidatedNewContactMethodAction(); }, [pendingContactAction?.actionVerified]); diff --git a/src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx b/src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx index 208e28ab592b..2a544f8b5eaa 100644 --- a/src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx +++ b/src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx @@ -33,7 +33,7 @@ function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModal } // Dismiss modal on successful magic code verification - Navigation.navigate(ROUTES.SETTINGS_SECURITY); + Navigation.goBack(ROUTES.SETTINGS_SECURITY); }, [login, currentDelegate, role, addDelegateErrors]); const onBackButtonPress = () => { diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 0751dd86125f..49a0d74e2bd6 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -345,6 +345,18 @@ function WorkspacesListPage() { }, {}); }, [reports]); + const navigateToWorkspace = useCallback( + (policyID: string) => { + // On the wide layout, we always want to open the Profile page when opening workpsace settings from the list + if (shouldUseNarrowLayout) { + Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID)); + return; + } + Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(policyID)); + }, + [shouldUseNarrowLayout], + ); + /** * Add free policies (workspaces) to the list of menu items and returns the list of menu items */ @@ -380,7 +392,7 @@ function WorkspacesListPage() { return { title: policy.name, icon: policy.avatarURL ? policy.avatarURL : getDefaultWorkspaceAvatar(policy.name), - action: () => Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policy.id)), + action: () => navigateToWorkspace(policy.id), brickRoadIndicator: !isPolicyAdmin(policy) ? undefined : reimbursementAccountBrickRoadIndicator ?? @@ -405,7 +417,7 @@ function WorkspacesListPage() { }; }) .sort((a, b) => localeCompare(a.title, b.title)); - }, [reimbursementAccount?.errors, policies, isOffline, theme.textLight, policyRooms, session?.email, allConnectionSyncProgresses]); + }, [reimbursementAccount?.errors, policies, isOffline, session?.email, allConnectionSyncProgresses, theme.textLight, policyRooms, navigateToWorkspace]); const getHeaderButton = () => (