Skip to content

Commit

Permalink
Fix opening RHP in FullScreenNavigator
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Mar 1, 2024
1 parent 62ed5db commit 71a2425
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ function getAdaptedState(state: PartialState<NavigationState<RootStackParamList>
// If the root route is type of FullScreenNavigator, the default bottom tab will be added.
const matchingBottomTabRoute = getMatchingBottomTabRouteForState({routes: [matchingRootRoute]});
routes.push(createBottomTabNavigator(matchingBottomTabRoute, policyID));
// When we open a screen in RHP from FullScreenNavigator, we need to add the appropriate screen in CentralPane.
// Then, when we close FullScreenNavigator, we will be redirected to the correct page in CentralPane.
if (matchingRootRoute.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR) {

This comment has been minimized.

Copy link
@c3024

c3024 Mar 14, 2024

Contributor

@WojtekBoman

I think this is causing central pane getting replaced with WorkspaceListsPage whenever we navigate to CategorySettingsPage, CategorySettingsPage etc in a fresh session.

centralPaneReplaced.mp4

This comment has been minimized.

Copy link
@bernhardoj

bernhardoj Mar 16, 2024

Contributor

This one too #38420

routes.push(createCentralPaneNavigator({name: SCREENS.SETTINGS.WORKSPACES}));
}
if (!isNarrowLayout || !isRHPScreenOpenedFromLHN) {
routes.push(matchingRootRoute);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute';
import type {BottomTabName, NavigationPartialRoute, RootStackParamList, State} from '@libs/Navigation/types';
import NAVIGATORS from '@src/NAVIGATORS';
import SCREENS from '@src/SCREENS';
import {CENTRAL_PANE_TO_TAB_MAPPING} from './TAB_TO_CENTRAL_PANE_MAPPING';

// Get the route that matches the topmost central pane route in the navigation stack. e.g REPORT -> HOME
function getMatchingBottomTabRouteForState(state: State<RootStackParamList>, policyID?: string): NavigationPartialRoute<BottomTabName> {
const paramsWithPolicyID = policyID ? {policyID} : undefined;
const defaultRoute = {name: SCREENS.HOME, params: paramsWithPolicyID};
const isFullScreenNavigatorOpened = state.routes.some((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR);

if (isFullScreenNavigatorOpened) {
return {name: SCREENS.SETTINGS.ROOT, params: paramsWithPolicyID};
}

const topmostCentralPaneRoute = getTopmostCentralPaneRoute(state);

if (topmostCentralPaneRoute === undefined) {
Expand Down

0 comments on commit 71a2425

Please sign in to comment.