diff --git a/src/components/Navigation/NavigationTabBar/index.tsx b/src/components/Navigation/NavigationTabBar/index.tsx index c0d67e0c370c..ae8c66057f6c 100644 --- a/src/components/Navigation/NavigationTabBar/index.tsx +++ b/src/components/Navigation/NavigationTabBar/index.tsx @@ -5,7 +5,6 @@ import {View} from 'react-native'; import type {ValueOf} from 'type-fest'; import HeaderGap from '@components/HeaderGap'; import Icon from '@components/Icon'; -// import * as Expensicons from '@components/Icon/Expensicons'; import ImageSVG from '@components/ImageSVG'; import DebugTabView from '@components/Navigation/DebugTabView'; import {PressableWithFeedback} from '@components/Pressable'; @@ -122,8 +121,13 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false}: NavigationTabBar return; } + if (!shouldUseNarrowLayout && isRoutePreloaded(NAVIGATORS.REPORTS_SPLIT_NAVIGATOR)) { + navigationRef.dispatch(StackActions.push(NAVIGATORS.REPORTS_SPLIT_NAVIGATOR)); + return; + } + Navigation.navigate(ROUTES.HOME); - }, [selectedTab]); + }, [selectedTab, shouldUseNarrowLayout]); const navigateToSearch = useCallback(() => { if (selectedTab === NAVIGATION_TABS.SEARCH) { diff --git a/src/libs/Navigation/AppNavigator/usePreloadFullScreenNavigators.ts b/src/libs/Navigation/AppNavigator/usePreloadFullScreenNavigators.ts index 9cb6a7aed8ec..c7581905db80 100644 --- a/src/libs/Navigation/AppNavigator/usePreloadFullScreenNavigators.ts +++ b/src/libs/Navigation/AppNavigator/usePreloadFullScreenNavigators.ts @@ -24,8 +24,8 @@ import {getPreservedNavigatorState} from './createSplitNavigator/usePreserveNavi // This timing is used to call the preload function after a tab change, when the initial tab screen has already been rendered. const TIMING_TO_CALL_PRELOAD = 1000; -// Currently, only the Account and Workspaces tabs are preloaded. The remaining tabs will be supported soon. -const TABS_TO_PRELOAD = [NAVIGATION_TABS.SETTINGS, NAVIGATION_TABS.WORKSPACES]; +// Currently, only the Inbox, Workspaces, Account tabs are preloaded. The remaining tabs will be supported soon. +const TABS_TO_PRELOAD = [NAVIGATION_TABS.HOME, NAVIGATION_TABS.WORKSPACES, NAVIGATION_TABS.SETTINGS]; function preloadWorkspacesTab(navigation: PlatformStackNavigationProp) { const state = getWorkspacesTabStateFromSessionStorage() ?? navigation.getState();