Skip to content

Commit

Permalink
Merge pull request #39788 from bernhardoj/fix/38390-going-back-from-p…
Browse files Browse the repository at this point in the history
…rofile-leads-to-report

Don't add report screen by default when visiting RHP in narrow layout
  • Loading branch information
deetergp committed Apr 9, 2024
2 parents d088580 + 60cadc2 commit b9bd07f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,19 @@ function getAdaptedState(state: PartialState<NavigationState<RootStackParamList>
if (!matchingRootRoute || isRHPScreenOpenedFromLHN) {
metainfo.isCentralPaneAndBottomTabMandatory = false;
metainfo.isFullScreenNavigatorMandatory = false;
matchingRootRoute = matchingRootRoute ?? createCentralPaneNavigator({name: SCREENS.REPORT});
// If matchingRootRoute is undefined and it's a narrow layout, don't add a report screen under the RHP.
matchingRootRoute = matchingRootRoute ?? (!isNarrowLayout ? createCentralPaneNavigator({name: SCREENS.REPORT}) : undefined);
}

// If the root route is type of FullScreenNavigator, the default bottom tab will be added.
const matchingBottomTabRoute = getMatchingBottomTabRouteForState({routes: [matchingRootRoute]});
const matchingBottomTabRoute = getMatchingBottomTabRouteForState({routes: matchingRootRoute ? [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) {
if (matchingRootRoute?.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR) {
routes.push(createCentralPaneNavigator({name: SCREENS.SETTINGS.WORKSPACES}));
}
if (!isNarrowLayout || !isRHPScreenOpenedFromLHN) {
if (matchingRootRoute && (!isNarrowLayout || !isRHPScreenOpenedFromLHN)) {
routes.push(matchingRootRoute);
}
}
Expand Down

0 comments on commit b9bd07f

Please sign in to comment.