|
1 | 1 | import getTopmostBottomTabRoute from '@libs/Navigation/getTopmostBottomTabRoute';
|
2 | 2 | import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute';
|
| 3 | +import getTopmostFullScreenRoute from '@libs/Navigation/getTopmostFullScreenRoute'; |
3 | 4 | import type {Metainfo} from '@libs/Navigation/linkingConfig/getAdaptedStateFromPath';
|
4 | 5 | import type {NavigationPartialRoute, RootStackParamList, State} from '@libs/Navigation/types';
|
5 | 6 | import NAVIGATORS from '@src/NAVIGATORS';
|
@@ -73,10 +74,19 @@ function getPartialStateDiff(state: State<RootStackParamList>, templateState: St
|
73 | 74 | // This one is heuristic and may need to be improved if we will be able to navigate from modal screen with full screen in background to another modal screen with full screen in background.
|
74 | 75 | // For now this simple check is enough.
|
75 | 76 | if (metainfo.isFullScreenNavigatorMandatory) {
|
76 |
| - const stateTopmostFullScreen = state.routes.filter((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR).at(-1); |
77 |
| - const templateStateTopmostFullScreen = templateState.routes.filter((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR).at(-1) as NavigationPartialRoute; |
78 |
| - if (!stateTopmostFullScreen && templateStateTopmostFullScreen) { |
79 |
| - diff[NAVIGATORS.FULL_SCREEN_NAVIGATOR] = templateStateTopmostFullScreen; |
| 77 | + const stateTopmostFullScreen = getTopmostFullScreenRoute(state); |
| 78 | + const templateStateTopmostFullScreen = getTopmostFullScreenRoute(templateState); |
| 79 | + const fullScreenDiff = templateState.routes.filter((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR).at(-1) as NavigationPartialRoute; |
| 80 | + |
| 81 | + if ( |
| 82 | + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing |
| 83 | + (!stateTopmostFullScreen && templateStateTopmostFullScreen) || |
| 84 | + (stateTopmostFullScreen && |
| 85 | + templateStateTopmostFullScreen && |
| 86 | + stateTopmostFullScreen.name !== templateStateTopmostFullScreen.name && |
| 87 | + !shallowCompare(stateTopmostFullScreen.params, templateStateTopmostFullScreen.params)) |
| 88 | + ) { |
| 89 | + diff[NAVIGATORS.FULL_SCREEN_NAVIGATOR] = fullScreenDiff; |
80 | 90 | }
|
81 | 91 | }
|
82 | 92 |
|
|
0 commit comments