Skip to content

Commit

Permalink
Merge pull request #39150 from software-mansion-labs/fix/opening-work…
Browse files Browse the repository at this point in the history
…space-on-small-screens

Fix opening workspace settings on small screen
  • Loading branch information
luacmartins authored Mar 29, 2024
2 parents 65a122f + 4b708c6 commit 8c40e03
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libs/Navigation/linkTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
const policyIDFromState = getPolicyIDFromState(rootState);
const policyID = extractedPolicyID ?? policyIDFromState;

const isNarrowLayout = getIsNarrowLayout();

const isFullScreenOnTop = rootState.routes?.at(-1)?.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR;

if (policyID && !isFullScreenOnTop) {
Expand Down Expand Up @@ -194,8 +196,8 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
root.dispatch(diffAction);
}
}
// All actions related to FullScreenNavigator are pushed when comparing differences between rootState and adaptedState.
if (action.payload.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR) {
// All actions related to FullScreenNavigator on wide screen are pushed when comparing differences between rootState and adaptedState.
if (action.payload.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR && !isNarrowLayout) {
return;
}
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;
Expand All @@ -213,7 +215,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
root.dispatch(actionForBottomTabNavigator);

// If the layout is wide we need to push matching central pane route to the stack.
if (!getIsNarrowLayout()) {
if (!isNarrowLayout) {
// stateFromPath should always include bottom tab navigator state, so getMatchingCentralPaneRouteForState will be always defined.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const matchingCentralPaneRoute = getMatchingCentralPaneRouteForState(stateFromPath, rootState)!;
Expand Down

0 comments on commit 8c40e03

Please sign in to comment.