Skip to content

Commit bf145c8

Browse files
luacmartinsOSBotify
authored andcommitted
Merge pull request #89286 from software-mansion-labs/war-in/fix-ios-swipe
fix: iOS swipe gesture (cherry picked from commit da38a3b) (cherry-picked to staging by luacmartins)
1 parent acc2cc0 commit bf145c8

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/libs/Navigation/AppNavigator/Navigators/ROOT_TAB_SCREENS.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/libs/Navigation/AppNavigator/Navigators/TabNavigatorBar.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import useThemeStyles from '@hooks/useThemeStyles';
1313
import getFocusedLeafScreenName from '@libs/Navigation/helpers/getFocusedLeafScreenName';
1414
import NAVIGATORS from '@src/NAVIGATORS';
1515
import SCREENS from '@src/SCREENS';
16-
import ROOT_TAB_SCREENS from './ROOT_TAB_SCREENS';
1716

1817
const ROUTE_TO_NAVIGATION_TAB: Record<string, ValueOf<typeof NAVIGATION_TABS>> = {
1918
[SCREENS.HOME]: NAVIGATION_TABS.HOME,
@@ -31,7 +30,21 @@ const TAB_WRAPPER_NAVIGATORS = new Set<string>([
3130
NAVIGATORS.WORKSPACE_NAVIGATOR,
3231
]);
3332

34-
const isAtTabRootLevel = (name: string | undefined): boolean => !name || ROOT_TAB_SCREENS.has(name) || TAB_WRAPPER_NAVIGATORS.has(name);
33+
/**
34+
* Leaf screen names that represent the root/landing view of each tab.
35+
* Used to decide tab-bar visibility.
36+
*/
37+
const SCREENS_WITH_TAB_BAR = new Set<string>([
38+
SCREENS.HOME,
39+
SCREENS.INBOX,
40+
SCREENS.SEARCH.ROOT,
41+
SCREENS.SETTINGS.ROOT,
42+
SCREENS.WORKSPACES_LIST,
43+
SCREENS.WORKSPACE.INITIAL,
44+
SCREENS.DOMAIN.INITIAL,
45+
]);
46+
47+
const isAtTabRootLevel = (name: string | undefined): boolean => !name || SCREENS_WITH_TAB_BAR.has(name) || TAB_WRAPPER_NAVIGATORS.has(name);
3548

3649
// Deepest `screen` in a `{screen, params}` chain (e.g. WORKSPACE_NAV → WORKSPACE_SPLIT_NAV → WORKSPACE.INITIAL).
3750
const getPushTargetLeaf = (params: unknown): string | undefined => {

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

Lines changed: 6 additions & 1 deletion
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 ROOT_TAB_SCREENS from '@libs/Navigation/AppNavigator/Navigators/ROOT_TAB_SCREENS';
54
import findMatchingDynamicSuffix from '@libs/Navigation/helpers/dynamicRoutesUtils/findMatchingDynamicSuffix';
65
import {getMatchingFullScreenRoute, isFullScreenName} from '@libs/Navigation/helpers/getAdaptedStateFromPath';
76
import getStateFromPath from '@libs/Navigation/helpers/getStateFromPath';
@@ -23,6 +22,12 @@ const defaultLinkToOptions: LinkToOptions = {
2322
forceReplace: false,
2423
};
2524

25+
/**
26+
* Leaf screen names that represent the root/landing view of each tab.
27+
* Used to distinguish plain tab switches from cross-tab deep navigations.
28+
*/
29+
const ROOT_TAB_SCREENS = new Set<string>([SCREENS.HOME, SCREENS.INBOX, SCREENS.SEARCH.ROOT, SCREENS.SETTINGS.ROOT, SCREENS.WORKSPACES_LIST]);
30+
2631
function areNamesAndParamsEqual(currentState: NavigationState<RootNavigatorParamList>, stateFromPath: PartialState<NavigationState<RootNavigatorParamList>>) {
2732
const currentFocusedRoute = findFocusedRoute(currentState);
2833
const targetFocusedRoute = findFocusedRoute(stateFromPath);

0 commit comments

Comments
 (0)