Skip to content

Commit

Permalink
Merge pull request #41317 from nkdengineer/fix/40743
Browse files Browse the repository at this point in the history
fix: back arrow twice to return to LHN
  • Loading branch information
robertjchen authored May 1, 2024
2 parents 57d2aee + 4114956 commit 5f50430
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libs/Navigation/linkTo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {getActionFromState} from '@react-navigation/core';
import type {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native';
import {omitBy} from 'lodash';
import type {Writable} from 'type-fest';
import getIsNarrowLayout from '@libs/getIsNarrowLayout';
import shallowCompare from '@libs/ObjectUtils';
Expand Down Expand Up @@ -153,8 +154,10 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
const isTargetNavigatorOnTop = topRouteName === action.payload.name;

const isTargetScreenDifferentThanCurrent = Boolean(topmostCentralPaneRoute && topmostCentralPaneRoute.name !== action.payload.params?.screen);
const areParamsDifferent = !shallowCompare(topmostCentralPaneRoute?.params, action.payload.params?.params);

const areParamsDifferent = !shallowCompare(
omitBy(topmostCentralPaneRoute?.params, (value) => value === undefined),
omitBy(action.payload.params?.params, (value) => value === undefined),
);
// In case if type is 'FORCED_UP' we replace current screen with the provided. This means the current screen no longer exists in the stack
if (type === CONST.NAVIGATION.TYPE.FORCED_UP) {
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;
Expand Down

0 comments on commit 5f50430

Please sign in to comment.