diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index b07c12d37b5a..e8a321984f1c 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -1,6 +1,6 @@ import type {ParamListBase, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; import {StackRouter} from '@react-navigation/native'; -import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import SCREENS from '@src/SCREENS'; import type {FullScreenNavigatorRouterOptions} from './types'; @@ -9,11 +9,11 @@ type StackState = StackNavigationState | PartialState !!state.routes.find((route) => route.name === screenName); function adaptStateIfNecessary(state: StackState) { - const isSmallScreenWidth = getIsSmallScreenWidth(); + const isNarrowLayout = getIsNarrowLayout(); // If the screen is wide, there should be at least two screens inside: // - SETINGS.ROOT to cover left pane. // - SETTINGS_CENTRAL_PANE to cover central pane. - if (!isSmallScreenWidth) { + if (!isNarrowLayout) { if (!isAtLeastOneInState(state, SCREENS.SETTINGS.ROOT)) { // @ts-expect-error Updating read only property // noinspection JSConstantReassignment diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts index a59150019142..504803026994 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts @@ -1,7 +1,7 @@ import type {RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; import {getPathFromState, StackRouter} from '@react-navigation/native'; import type {ParamListBase} from '@react-navigation/routers'; -import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import getTopmostBottomTabRoute from '@libs/Navigation/getTopmostBottomTabRoute'; import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute'; import linkingConfig from '@libs/Navigation/linkingConfig'; @@ -38,10 +38,10 @@ function compareAndAdaptState(state: StackNavigationState) { // We need to be sure that the bottom tab state is defined. const topmostBottomTabRoute = getTopmostBottomTabRoute(state); - const isSmallScreenWidth = getIsSmallScreenWidth(); + const isNarrowLayout = getIsNarrowLayout(); // This solutions is heuristics and will work for our cases. We may need to improve it in the future if we will have more cases to handle. - if (topmostBottomTabRoute && !isSmallScreenWidth) { + if (topmostBottomTabRoute && !isNarrowLayout) { const fullScreenRoute = state.routes.find((route) => route.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR); // If there is fullScreenRoute we don't need to add anything. diff --git a/src/libs/Navigation/linkTo.ts b/src/libs/Navigation/linkTo.ts index 49dcee71eda4..5a765d9a7d37 100644 --- a/src/libs/Navigation/linkTo.ts +++ b/src/libs/Navigation/linkTo.ts @@ -1,7 +1,7 @@ import {getActionFromState} from '@react-navigation/core'; import type {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native'; import type {Writable} from 'type-fest'; -import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import {extractPolicyIDFromPath, getPathWithoutPolicyID} from '@libs/PolicyUtils'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; @@ -212,7 +212,7 @@ export default function linkTo(navigation: NavigationContainerRef>, policyID?: string): GetAdaptedStateReturnType { - const isSmallScreenWidth = getIsSmallScreenWidth(); + const isNarrowLayout = getIsNarrowLayout(); const metainfo = { isCentralPaneAndBottomTabMandatory: true, isFullScreenNavigatorMandatory: true, @@ -194,7 +194,7 @@ function getAdaptedState(state: PartialState policyID, ), ); - if (!isSmallScreenWidth) { + if (!isNarrowLayout) { routes.push( createCentralPaneNavigator({ name: SCREENS.REPORT, @@ -226,7 +226,7 @@ function getAdaptedState(state: PartialState policyID, ), ); - if (!isSmallScreenWidth) { + if (!isNarrowLayout) { routes.push(createCentralPaneNavigator({name: SCREENS.REPORT})); } routes.push(fullScreenNavigator); @@ -254,7 +254,7 @@ function getAdaptedState(state: PartialState // Routes // - found bottom tab // - matching central pane on desktop layout - if (isSmallScreenWidth) { + if (isNarrowLayout) { return { adaptedState: state, metainfo, diff --git a/src/libs/Navigation/switchPolicyID.ts b/src/libs/Navigation/switchPolicyID.ts index 4b9259c76ad7..9afb325eee99 100644 --- a/src/libs/Navigation/switchPolicyID.ts +++ b/src/libs/Navigation/switchPolicyID.ts @@ -2,7 +2,7 @@ import {getActionFromState} from '@react-navigation/core'; import type {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native'; import {getPathFromState} from '@react-navigation/native'; import type {ValueOf, Writable} from 'type-fest'; -import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; import type {Route} from '@src/ROUTES'; @@ -95,7 +95,7 @@ export default function switchPolicyID(navigation: NavigationContainerRef