diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 6cec46eae144..7e49c1613a62 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -51,10 +51,11 @@ export default function linkTo(navigation: NavigationContainerRef route?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT); + // 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 topRouteName = rootState?.routes?.at(-1)?.name; + const topRouteName = lastRoute?.name; const isTargetNavigatorOnTop = topRouteName === action.payload.name; const isTargetScreenDifferentThanCurrent = !!(!topmostCentralPaneRoute || topmostCentralPaneRoute.name !== action.payload.params?.screen); @@ -201,6 +204,11 @@ export default function linkTo(navigation: NavigationContainerRef