Skip to content

Commit 687634a

Browse files
committed
remove logic that isn't needed and was introduced after incorrect merge
1 parent 4ce9da3 commit 687634a

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

  • src/libs/Navigation/helpers/linkTo

src/libs/Navigation/helpers/linkTo/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {getActionFromState} from '@react-navigation/core';
22
import type {NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native';
33
import {CommonActions, findFocusedRoute} from '@react-navigation/native';
4-
import findMatchingDynamicSuffix from '@libs/Navigation/helpers/dynamicRoutesUtils/findMatchingDynamicSuffix';
54
import {getMatchingFullScreenRoute, isFullScreenName} from '@libs/Navigation/helpers/getAdaptedStateFromPath';
65
import getStateFromPath from '@libs/Navigation/helpers/getStateFromPath';
76
import normalizePath from '@libs/Navigation/helpers/normalizePath';
@@ -158,17 +157,8 @@ export default function linkTo(navigation: NavigationContainerRef<RootNavigatorP
158157
return;
159158
}
160159

161-
const isDynamicRoute = !!findMatchingDynamicSuffix(normalizedPath);
162160
const typedPayload = (action as {payload: {name?: string; params?: ActionPayloadParams}}).payload;
163161

164-
// If a RIGHT_MODAL_NAVIGATOR already sits below the focused TAB_NAVIGATOR, NAVIGATE pops back to it
165-
// (dropping the tab above) instead of stacking - anchoring the new RHP on the wrong tab.
166-
// PUSH so the new RHP lands above the current tab. See https://github.com/Expensify/App/issues/88965.
167-
const targetIsRightModal = typedPayload?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;
168-
const focusIsOnTabNavigator = currentState.routes[currentState.index]?.name === NAVIGATORS.TAB_NAVIGATOR;
169-
const isRhpNavigationFromStackedTab =
170-
targetIsRightModal && focusIsOnTabNavigator && currentState.routes.some((route, index) => route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && index < currentState.index);
171-
172162
if (forceReplace) {
173163
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;
174164
}
@@ -181,8 +171,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootNavigatorP
181171
action.type === CONST.NAVIGATION.ACTION_TYPE.NAVIGATE &&
182172
!isNavigatingToAttachmentScreen(focusedRouteFromPath?.name) &&
183173
!isNavigatingToReportWithSameReportID(currentFocusedRoute, focusedRouteFromPath) &&
184-
!isSwitchingTabsWithinTabNavigator(currentState, stateFromPath) &&
185-
(!isDynamicRoute || isRhpNavigationFromStackedTab)
174+
!isSwitchingTabsWithinTabNavigator(currentState, stateFromPath)
186175
) {
187176
// We want to PUSH by default to add entries to the browser history.
188177
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

0 commit comments

Comments
 (0)