Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opening FullScreenNavigator from the Home page #38734

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/libs/Navigation/linkTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
}
let root: NavigationRoot = navigation;
let current: NavigationRoot | undefined;

// Traverse up to get the root navigation
// eslint-disable-next-line no-cond-assign
while ((current = root.getParent())) {
Expand All @@ -145,7 +144,6 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
}

const action: StackNavigationAction = getActionFromState(stateFromPath, linkingConfig.config);

// If action type is different than NAVIGATE we can't change it to the PUSH safely
if (action?.type === CONST.NAVIGATION.ACTION_TYPE.NAVIGATE) {
const topmostCentralPaneRoute = getTopmostCentralPaneRoute(rootState);
Expand Down Expand Up @@ -181,12 +179,11 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
} else if (type === CONST.NAVIGATION.TYPE.UP) {
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;

// If this action is navigating to the ModalNavigator and the last route on the root navigator is not already opened ModalNavigator then push
} else if (isModalNavigator(action.payload.name) && !isTargetNavigatorOnTop) {
// If this action is navigating to ModalNavigator or FullScreenNavigator and the last route on the root navigator is not already opened Navigator then push
} else if ((action.payload.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR || isModalNavigator(action.payload.name)) && !isTargetNavigatorOnTop) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, after this change, I can't open the workspace page on native and mWeb.

Screen.Recording.2024-03-28.at.13.57.46.mov

Copy link
Contributor Author

@WojtekBoman WojtekBoman Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for noticing that. I see that 2 days ago this PR was merged #38977. It has introduced some changes to the navigation logic. When I was working on this PR, these changes weren't merged yet. I'll try to adjust my fix :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Came here to point out the same issue

if (isModalNavigator(topRouteName)) {
dismissModal(navigation);
}
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

// If this RHP has mandatory central pane and bottom tab screens defined we need to push them.
const {adaptedState, metainfo} = getAdaptedStateFromPath(path, linkingConfig.config);
Expand All @@ -197,6 +194,12 @@ 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) {
return;
}
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
} else if (action.payload.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR) {
// If path contains a policyID, we should invoke the navigate function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ function getAdaptedState(state: PartialState<NavigationState<RootStackParamList>
// - default central pane on desktop layout
// - found fullscreen

// Full screen navigator can have any central pane and bottom tab under. They will be covered anyway.
metainfo.isCentralPaneAndBottomTabMandatory = false;

const routes = [];
routes.push(
createBottomTabNavigator(
Expand Down
Loading