Skip to content

Commit 83a1ea6

Browse files
authored
Merge pull request #89921 from software-mansion-labs/collectioneur/fix-link-to
Fix Personal Card - Background page does not change when navigating to wallet page
2 parents 5ecef7a + 687634a commit 83a1ea6

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';
@@ -169,17 +168,8 @@ export default function linkTo(navigation: NavigationContainerRef<RootNavigatorP
169168
return;
170169
}
171170

172-
const isDynamicRoute = !!findMatchingDynamicSuffix(normalizedPath);
173171
const typedPayload = (action as {payload: {name?: string; params?: ActionPayloadParams}}).payload;
174172

175-
// If a RIGHT_MODAL_NAVIGATOR already sits below the focused TAB_NAVIGATOR, NAVIGATE pops back to it
176-
// (dropping the tab above) instead of stacking - anchoring the new RHP on the wrong tab.
177-
// PUSH so the new RHP lands above the current tab. See https://github.com/Expensify/App/issues/88965.
178-
const targetIsRightModal = typedPayload?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;
179-
const focusIsOnTabNavigator = currentState.routes[currentState.index]?.name === NAVIGATORS.TAB_NAVIGATOR;
180-
const isRhpNavigationFromStackedTab =
181-
targetIsRightModal && focusIsOnTabNavigator && currentState.routes.some((route, index) => route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR && index < currentState.index);
182-
183173
if (forceReplace) {
184174
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;
185175
}
@@ -192,8 +182,7 @@ export default function linkTo(navigation: NavigationContainerRef<RootNavigatorP
192182
action.type === CONST.NAVIGATION.ACTION_TYPE.NAVIGATE &&
193183
!isNavigatingToAttachmentScreen(focusedRouteFromPath?.name) &&
194184
!isNavigatingToReportWithSameReportID(currentFocusedRoute, focusedRouteFromPath) &&
195-
!isSwitchingTabsWithinTabNavigator(currentState, stateFromPath) &&
196-
(!isDynamicRoute || isRhpNavigationFromStackedTab)
185+
!isSwitchingTabsWithinTabNavigator(currentState, stateFromPath)
197186
) {
198187
// We want to PUSH by default to add entries to the browser history.
199188
action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

0 commit comments

Comments
 (0)