diff --git a/src/components/DeeplinkWrapper/index.website.tsx b/src/components/DeeplinkWrapper/index.website.tsx index 73427f0d11aa..9848902a817f 100644 --- a/src/components/DeeplinkWrapper/index.website.tsx +++ b/src/components/DeeplinkWrapper/index.website.tsx @@ -1,9 +1,9 @@ import {Str} from 'expensify-common'; import {useEffect, useRef, useState} from 'react'; import * as Browser from '@libs/Browser'; +import {shouldPreventDeeplinkPrompt} from '@libs/Navigation/helpers'; import Navigation from '@libs/Navigation/Navigation'; import navigationRef from '@libs/Navigation/navigationRef'; -import shouldPreventDeeplinkPrompt from '@libs/Navigation/shouldPreventDeeplinkPrompt'; import * as App from '@userActions/App'; import * as Link from '@userActions/Link'; import * as Session from '@userActions/Session'; diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx index 80fd84b05289..f156a43db5a6 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx @@ -10,7 +10,7 @@ import Text from '@components/Text'; import useCurrentReportID from '@hooks/useCurrentReportID'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@navigation/Navigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/components/Lottie/index.tsx b/src/components/Lottie/index.tsx index 017d68aa4b56..190b24cbbf7b 100644 --- a/src/components/Lottie/index.tsx +++ b/src/components/Lottie/index.tsx @@ -9,7 +9,7 @@ import useAppState from '@hooks/useAppState'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; -import isSideModalNavigator from '@libs/Navigation/isSideModalNavigator'; +import isSideModalNavigator from '@libs/Navigation/helpers/isSideModalNavigator'; import CONST from '@src/CONST'; import {useSplashScreenStateContext} from '@src/SplashScreenStateContext'; diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 8bf07e2d3a02..d29d7e324a73 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -9,7 +9,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {getCurrentUserAccountID} from '@libs/actions/Report'; import * as CurrencyUtils from '@libs/CurrencyUtils'; -import isReportOpenInRHP from '@libs/Navigation/isReportOpenInRHP'; +import isReportOpenInRHP from '@libs/Navigation/helpers/isReportOpenInRHP'; import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; diff --git a/src/components/MoneyRequestHeader.tsx b/src/components/MoneyRequestHeader.tsx index 93ac363cff62..82b58f531daa 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -7,7 +7,7 @@ import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import isReportOpenInRHP from '@libs/Navigation/isReportOpenInRHP'; +import isReportOpenInRHP from '@libs/Navigation/helpers/isReportOpenInRHP'; import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; diff --git a/src/components/PromotedActionsBar.tsx b/src/components/PromotedActionsBar.tsx index b1a515097ebb..be4c734608c7 100644 --- a/src/components/PromotedActionsBar.tsx +++ b/src/components/PromotedActionsBar.tsx @@ -5,7 +5,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import * as HeaderUtils from '@libs/HeaderUtils'; import * as Localize from '@libs/Localize'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import * as ReportActions from '@userActions/Report'; diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index f3bfa508963f..12f81befc171 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -21,7 +21,7 @@ import * as SearchActions from '@libs/actions/Search'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import memoize from '@libs/memoize'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import * as ReportUtils from '@libs/ReportUtils'; import * as SearchQueryUtils from '@libs/SearchQueryUtils'; import * as SearchUIUtils from '@libs/SearchUIUtils'; diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index c09e041237e4..aa34add23c6e 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -24,9 +24,9 @@ import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import getOnboardingModalScreenOptions from '@libs/Navigation/getOnboardingModalScreenOptions'; +import {shouldOpenOnAdminRoom} from '@libs/Navigation/helpers'; import SIDEBAR_TO_SPLIT from '@libs/Navigation/linkingConfig/RELATIONS/SIDEBAR_TO_SPLIT'; import Navigation from '@libs/Navigation/Navigation'; -import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import NetworkConnection from '@libs/NetworkConnection'; import onyxSubscribe from '@libs/onyxSubscribe'; diff --git a/src/libs/Navigation/AppNavigator/Navigators/ReportsSplitNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/ReportsSplitNavigator.tsx index c83816a21b5d..40dfca227069 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/ReportsSplitNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/ReportsSplitNavigator.tsx @@ -5,7 +5,7 @@ import usePermissions from '@hooks/usePermissions'; import createSplitStackNavigator from '@libs/Navigation/AppNavigator/createSplitStackNavigator'; import FreezeWrapper from '@libs/Navigation/AppNavigator/FreezeWrapper'; import getCurrentUrl from '@libs/Navigation/currentUrl'; -import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; +import shouldOpenOnAdminRoom from '@libs/Navigation/helpers/shouldOpenOnAdminRoom'; import type {ReportsSplitNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts index f678425e2ec5..89df458567dd 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts @@ -3,7 +3,7 @@ import {findFocusedRoute, StackRouter} from '@react-navigation/native'; import type {ParamListBase} from '@react-navigation/routers'; import useActiveWorkspace from '@hooks/useActiveWorkspace'; import * as Localize from '@libs/Localize'; -import isSideModalNavigator from '@libs/Navigation/isSideModalNavigator'; +import isSideModalNavigator from '@libs/Navigation/helpers/isSideModalNavigator'; import {isOnboardingFlowName} from '@libs/NavigationUtils'; import * as Welcome from '@userActions/Welcome'; import CONST from '@src/CONST'; @@ -69,7 +69,7 @@ function CustomRouter(options: ResponsiveStackNavigatorRouterOptions) { } if (isDismissModalAction(action)) { - return GetStateForActionHandlers.handleDismissModalAction(state, action, configOptions, stackRouter); + return GetStateForActionHandlers.handleDismissModalAction(state, configOptions, stackRouter); } if (isPushAction(action)) { diff --git a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/GetStateForActionHandlers.ts b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/GetStateForActionHandlers.ts index b2af8cd41f98..1a952c0c6caa 100644 --- a/src/libs/Navigation/AppNavigator/createCustomStackNavigator/GetStateForActionHandlers.ts +++ b/src/libs/Navigation/AppNavigator/createCustomStackNavigator/GetStateForActionHandlers.ts @@ -2,12 +2,12 @@ import type {CommonActions, RouterConfigOptions, StackActionType, StackNavigatio import {StackActions} from '@react-navigation/native'; import type {ParamListBase, Router} from '@react-navigation/routers'; import Log from '@libs/Log'; -import getPolicyIDFromState from '@libs/Navigation/getPolicyIDFromState'; +import getPolicyIDFromState from '@libs/Navigation/helpers/getPolicyIDFromState'; import type {RootStackParamList, State} from '@libs/Navigation/types'; import * as SearchQueryUtils from '@libs/SearchQueryUtils'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; -import type {DismissModalActionType, PushActionType, SwitchPolicyIdActionType} from './types'; +import type {PushActionType, SwitchPolicyIdActionType} from './types'; const MODAL_ROUTES_TO_DISMISS: string[] = [ NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR, @@ -137,7 +137,6 @@ function handlePushSearchPageAction( function handleDismissModalAction( state: StackNavigationState, - action: DismissModalActionType, configOptions: RouterConfigOptions, stackRouter: Router, CommonActions.Action | StackActionType>, ) { diff --git a/src/libs/Navigation/AppNavigator/createSplitStackNavigator/SplitStackRouter.ts b/src/libs/Navigation/AppNavigator/createSplitStackNavigator/SplitStackRouter.ts index 6dd910985b41..3bc1e50717ec 100644 --- a/src/libs/Navigation/AppNavigator/createSplitStackNavigator/SplitStackRouter.ts +++ b/src/libs/Navigation/AppNavigator/createSplitStackNavigator/SplitStackRouter.ts @@ -2,7 +2,7 @@ import type {CommonActions, ParamListBase, PartialState, RouterConfigOptions, St import {StackActions, StackRouter} from '@react-navigation/native'; import pick from 'lodash/pick'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; -import getParamsFromRoute from '@libs/Navigation/linkingConfig/getParamsFromRoute'; +import {getParamsFromRoute} from '@libs/Navigation/helpers'; import navigationRef from '@libs/Navigation/navigationRef'; import SCREENS from '@src/SCREENS'; import type {SplitStackNavigatorRouterOptions} from './types'; diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 8013eb6c20c3..b1d32c5f6016 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -20,18 +20,20 @@ import ROUTES, {HYBRID_APP_ROUTES} from '@src/ROUTES'; import SCREENS, {PROTECTED_SCREENS} from '@src/SCREENS'; import type {Report} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import originalCloseRHPFlow from './closeRHPFlow'; -import getPolicyIDFromState from './getPolicyIDFromState'; -import getStateFromPath from './getStateFromPath'; -import getTopmostReportParam from './getTopmostReportParam'; -import isReportOpenInRHP from './isReportOpenInRHP'; +import { + createSplitNavigator, + getPolicyIDFromState, + getStateFromPath, + getTopmostReportParam, + isReportOpenInRHP, + closeRHPFlow as originalCloseRHPFlow, + setNavigationActionToMicrotaskQueue, +} from './helpers'; import linkingConfig from './linkingConfig'; -import createSplitNavigator from './linkingConfig/createSplitNavigator'; import RELATIONS from './linkingConfig/RELATIONS'; import linkTo from './linkTo'; import getMinimalAction from './linkTo/getMinimalAction'; import navigationRef from './navigationRef'; -import setNavigationActionToMicrotaskQueue from './setNavigationActionToMicrotaskQueue'; import type {NavigationPartialRoute, NavigationStateRoute, RootStackParamList, State} from './types'; function getSidebarScreenParams(splitNavigatorRoute: NavigationStateRoute) { diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 01bca3a47d67..28ae804d44e3 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -22,9 +22,8 @@ import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import AppNavigator from './AppNavigator'; import {cleanPreservedSplitNavigatorStates} from './AppNavigator/createSplitStackNavigator/usePreserveSplitNavigatorState'; +import {customGetPathFromState, getAdaptedStateFromPath} from './helpers'; import linkingConfig from './linkingConfig'; -import customGetPathFromState from './linkingConfig/customGetPathFromState'; -import getAdaptedStateFromPath from './linkingConfig/getAdaptedStateFromPath'; import Navigation, {navigationRef} from './Navigation'; import setupCustomAndroidBackHandler from './setupCustomAndroidBackHandler'; diff --git a/src/libs/Navigation/closeRHPFlow.ts b/src/libs/Navigation/helpers/closeRHPFlow.ts similarity index 94% rename from src/libs/Navigation/closeRHPFlow.ts rename to src/libs/Navigation/helpers/closeRHPFlow.ts index 9bc40f51f472..0f814ca13bb7 100644 --- a/src/libs/Navigation/closeRHPFlow.ts +++ b/src/libs/Navigation/helpers/closeRHPFlow.ts @@ -1,8 +1,8 @@ import type {NavigationContainerRef} from '@react-navigation/native'; import {StackActions} from '@react-navigation/native'; import Log from '@libs/Log'; +import type {RootStackParamList} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; -import type {RootStackParamList} from './types'; /** * Closes the last RHP flow, if there is only one, closes the entire RHP. diff --git a/src/libs/Navigation/linkingConfig/createNormalizedConfigs.ts b/src/libs/Navigation/helpers/createNormalizedConfigs.ts similarity index 100% rename from src/libs/Navigation/linkingConfig/createNormalizedConfigs.ts rename to src/libs/Navigation/helpers/createNormalizedConfigs.ts diff --git a/src/libs/Navigation/linkingConfig/createSplitNavigator.ts b/src/libs/Navigation/helpers/createSplitNavigator.ts similarity index 91% rename from src/libs/Navigation/linkingConfig/createSplitNavigator.ts rename to src/libs/Navigation/helpers/createSplitNavigator.ts index c2d09d28dc87..a43e5a83d7ab 100644 --- a/src/libs/Navigation/linkingConfig/createSplitNavigator.ts +++ b/src/libs/Navigation/helpers/createSplitNavigator.ts @@ -1,6 +1,6 @@ import type {NavigationState, PartialState} from '@react-navigation/native'; +import LHN_TO_SPLIT_NAVIGATOR_NAME from '@libs/Navigation/linkingConfig/RELATIONS/LHN_TO_SPLIT_NAVIGATOR_MAPPING'; import type {NavigationPartialRoute, SplitNavigatorByLHN, SplitNavigatorLHNScreen, SplitNavigatorParamListType} from '@libs/Navigation/types'; -import LHN_TO_SPLIT_NAVIGATOR_NAME from './RELATIONS/LHN_TO_SPLIT_NAVIGATOR_MAPPING'; type ExtractRouteType = Extract; @@ -25,4 +25,5 @@ function createSplitNavigator( params: splitNavigatorParams, }; } + export default createSplitNavigator; diff --git a/src/libs/Navigation/linkingConfig/customGetPathFromState.ts b/src/libs/Navigation/helpers/customGetPathFromState.ts similarity index 100% rename from src/libs/Navigation/linkingConfig/customGetPathFromState.ts rename to src/libs/Navigation/helpers/customGetPathFromState.ts diff --git a/src/libs/Navigation/extractPolicyIDFromQuery.ts b/src/libs/Navigation/helpers/extractPolicyIDFromQuery.ts similarity index 89% rename from src/libs/Navigation/extractPolicyIDFromQuery.ts rename to src/libs/Navigation/helpers/extractPolicyIDFromQuery.ts index f091690c16f2..d37ded16b4b5 100644 --- a/src/libs/Navigation/extractPolicyIDFromQuery.ts +++ b/src/libs/Navigation/helpers/extractPolicyIDFromQuery.ts @@ -1,5 +1,5 @@ +import type {NavigationPartialRoute} from '@libs/Navigation/types'; import * as SearchQueryUtils from '@libs/SearchQueryUtils'; -import type {NavigationPartialRoute} from './types'; function extractPolicyIDFromQuery(route?: NavigationPartialRoute) { if (!route?.params) { diff --git a/src/libs/Navigation/extrapolateStateFromParams.ts b/src/libs/Navigation/helpers/extrapolateStateFromParams.ts similarity index 100% rename from src/libs/Navigation/extrapolateStateFromParams.ts rename to src/libs/Navigation/helpers/extrapolateStateFromParams.ts diff --git a/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts b/src/libs/Navigation/helpers/getAdaptedStateFromPath.ts similarity index 98% rename from src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts rename to src/libs/Navigation/helpers/getAdaptedStateFromPath.ts index 4108a12b7253..a3f5bc3af16f 100644 --- a/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts +++ b/src/libs/Navigation/helpers/getAdaptedStateFromPath.ts @@ -2,18 +2,18 @@ import type {NavigationState, PartialState, Route} from '@react-navigation/nativ import {findFocusedRoute, getStateFromPath} from '@react-navigation/native'; import pick from 'lodash/pick'; import {isAnonymousUser} from '@libs/actions/Session'; +import config from '@libs/Navigation/linkingConfig/config'; +import RELATIONS from '@libs/Navigation/linkingConfig/RELATIONS'; import type {NavigationPartialRoute, RootStackParamList} from '@libs/Navigation/types'; import {isFullScreenName} from '@libs/NavigationUtils'; import {extractPolicyIDFromPath, getPathWithoutPolicyID} from '@libs/PolicyUtils'; import * as ReportConnection from '@libs/ReportConnection'; -import extractPolicyIDFromQuery from '@navigation/extractPolicyIDFromQuery'; import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import SCREENS from '@src/SCREENS'; -import config from './config'; import createSplitNavigator from './createSplitNavigator'; +import extractPolicyIDFromQuery from './extractPolicyIDFromQuery'; import getParamsFromRoute from './getParamsFromRoute'; -import RELATIONS from './RELATIONS'; import replacePathInNestedState from './replacePathInNestedState'; type GetAdaptedStateReturnType = { diff --git a/src/libs/Navigation/linkingConfig/getOnboardingAdaptedState.ts b/src/libs/Navigation/helpers/getOnboardingAdaptedState.ts similarity index 100% rename from src/libs/Navigation/linkingConfig/getOnboardingAdaptedState.ts rename to src/libs/Navigation/helpers/getOnboardingAdaptedState.ts diff --git a/src/libs/Navigation/linkingConfig/getParamsFromRoute.ts b/src/libs/Navigation/helpers/getParamsFromRoute.ts similarity index 80% rename from src/libs/Navigation/linkingConfig/getParamsFromRoute.ts rename to src/libs/Navigation/helpers/getParamsFromRoute.ts index 0b020ddbd7bf..1dd815f65e9b 100644 --- a/src/libs/Navigation/linkingConfig/getParamsFromRoute.ts +++ b/src/libs/Navigation/helpers/getParamsFromRoute.ts @@ -1,5 +1,5 @@ +import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config'; import type {Screen} from '@src/SCREENS'; -import {normalizedConfigs} from './config'; function getParamsFromRoute(screenName: string): string[] { const routeConfig = normalizedConfigs[screenName as Screen]; diff --git a/src/libs/Navigation/getPolicyIDFromState.ts b/src/libs/Navigation/helpers/getPolicyIDFromState.ts similarity index 97% rename from src/libs/Navigation/getPolicyIDFromState.ts rename to src/libs/Navigation/helpers/getPolicyIDFromState.ts index f5604c8a3733..b4b81ee15db8 100644 --- a/src/libs/Navigation/getPolicyIDFromState.ts +++ b/src/libs/Navigation/helpers/getPolicyIDFromState.ts @@ -1,7 +1,7 @@ +import type {NavigationPartialRoute, RootStackParamList, State} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; import extractPolicyIDFromQuery from './extractPolicyIDFromQuery'; -import type {NavigationPartialRoute, RootStackParamList, State} from './types'; /** * returns policyID value if one exists in navigation state diff --git a/src/libs/Navigation/getStateFromPath.ts b/src/libs/Navigation/helpers/getStateFromPath.ts similarity index 93% rename from src/libs/Navigation/getStateFromPath.ts rename to src/libs/Navigation/helpers/getStateFromPath.ts index 50254bb3898d..19272ca3938f 100644 --- a/src/libs/Navigation/getStateFromPath.ts +++ b/src/libs/Navigation/helpers/getStateFromPath.ts @@ -1,7 +1,7 @@ import type {NavigationState, PartialState} from '@react-navigation/native'; import {getStateFromPath as RNGetStateFromPath} from '@react-navigation/native'; +import linkingConfig from '@libs/Navigation/linkingConfig'; import type {Route} from '@src/ROUTES'; -import linkingConfig from './linkingConfig'; /** * @param path - The path to parse diff --git a/src/libs/Navigation/getTopmostReportParam.ts b/src/libs/Navigation/helpers/getTopmostReportParam.ts similarity index 95% rename from src/libs/Navigation/getTopmostReportParam.ts rename to src/libs/Navigation/helpers/getTopmostReportParam.ts index 30354c7c6dd0..026cd379aa1a 100644 --- a/src/libs/Navigation/getTopmostReportParam.ts +++ b/src/libs/Navigation/helpers/getTopmostReportParam.ts @@ -1,7 +1,7 @@ import type {NavigationState, PartialState} from '@react-navigation/native'; +import type {RootStackParamList} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; -import type {RootStackParamList} from './types'; // This function is in a separate file than Navigation.ts to avoid cyclic dependency. diff --git a/src/libs/Navigation/getTopmostRouteName.ts b/src/libs/Navigation/helpers/getTopmostRouteName.ts similarity index 100% rename from src/libs/Navigation/getTopmostRouteName.ts rename to src/libs/Navigation/helpers/getTopmostRouteName.ts diff --git a/src/libs/Navigation/helpers/index.ts b/src/libs/Navigation/helpers/index.ts new file mode 100644 index 000000000000..56cc2c28611d --- /dev/null +++ b/src/libs/Navigation/helpers/index.ts @@ -0,0 +1,21 @@ +export * from './createNormalizedConfigs'; +export {default as customGetPathFromState} from './customGetPathFromState'; +export {default as getOnboardingAdaptedState} from './getOnboardingAdaptedState'; +export {default as getParamsFromRoute} from './getParamsFromRoute'; +export {default as normalizePath} from './normalizePath'; +export {default as replacePathInNestedState} from './replacePathInNestedState'; +export {default as createNormalizedConfigs} from './createNormalizedConfigs'; +export {default as createSplitNavigator} from './createSplitNavigator'; +export {default as getAdaptedStateFromPath} from './getAdaptedStateFromPath'; +export {default as extractPolicyIDFromQuery} from './extractPolicyIDFromQuery'; +export {default as closeRHPFlow} from './closeRHPFlow'; +export {default as getPolicyIDFromState} from './getPolicyIDFromState'; +export {default as getStateFromPath} from './getStateFromPath'; +export {default as getTopmostReportParam} from './getTopmostReportParam'; +export {default as getTopmostRouteName} from './getTopmostRouteName'; +export {default as isReportOpenInRHP} from './isReportOpenInRHP'; +export {default as isSearchTopmostFullScreenRoute} from './isSearchTopmostFullScreenRoute'; +export {default as isSideModalNavigator} from './isSideModalNavigator'; +export {default as setNavigationActionToMicrotaskQueue} from './setNavigationActionToMicrotaskQueue'; +export {default as shouldOpenOnAdminRoom} from './shouldOpenOnAdminRoom'; +export {default as shouldPreventDeeplinkPrompt} from './shouldPreventDeeplinkPrompt'; diff --git a/src/libs/Navigation/isReportOpenInRHP.ts b/src/libs/Navigation/helpers/isReportOpenInRHP.ts similarity index 100% rename from src/libs/Navigation/isReportOpenInRHP.ts rename to src/libs/Navigation/helpers/isReportOpenInRHP.ts diff --git a/src/libs/Navigation/isSearchTopmostFullScreenRoute.ts b/src/libs/Navigation/helpers/isSearchTopmostFullScreenRoute.ts similarity index 77% rename from src/libs/Navigation/isSearchTopmostFullScreenRoute.ts rename to src/libs/Navigation/helpers/isSearchTopmostFullScreenRoute.ts index 5599ec650c14..4991ae40a7e5 100644 --- a/src/libs/Navigation/isSearchTopmostFullScreenRoute.ts +++ b/src/libs/Navigation/helpers/isSearchTopmostFullScreenRoute.ts @@ -1,7 +1,7 @@ +import {navigationRef} from '@libs/Navigation/Navigation'; +import type {RootStackParamList, State} from '@libs/Navigation/types'; import {isFullScreenName} from '@libs/NavigationUtils'; import SCREENS from '@src/SCREENS'; -import {navigationRef} from './Navigation'; -import type {RootStackParamList, State} from './types'; const isSearchTopmostFullScreenRoute = (): boolean => { const rootState = navigationRef.getRootState() as State; diff --git a/src/libs/Navigation/isSideModalNavigator.ts b/src/libs/Navigation/helpers/isSideModalNavigator.ts similarity index 100% rename from src/libs/Navigation/isSideModalNavigator.ts rename to src/libs/Navigation/helpers/isSideModalNavigator.ts diff --git a/src/libs/Navigation/linkingConfig/normalizePath.ts b/src/libs/Navigation/helpers/normalizePath.ts similarity index 100% rename from src/libs/Navigation/linkingConfig/normalizePath.ts rename to src/libs/Navigation/helpers/normalizePath.ts diff --git a/src/libs/Navigation/linkingConfig/replacePathInNestedState.ts b/src/libs/Navigation/helpers/replacePathInNestedState.ts similarity index 100% rename from src/libs/Navigation/linkingConfig/replacePathInNestedState.ts rename to src/libs/Navigation/helpers/replacePathInNestedState.ts diff --git a/src/libs/Navigation/setNavigationActionToMicrotaskQueue.ts b/src/libs/Navigation/helpers/setNavigationActionToMicrotaskQueue.ts similarity index 100% rename from src/libs/Navigation/setNavigationActionToMicrotaskQueue.ts rename to src/libs/Navigation/helpers/setNavigationActionToMicrotaskQueue.ts diff --git a/src/libs/Navigation/shouldOpenOnAdminRoom.ts b/src/libs/Navigation/helpers/shouldOpenOnAdminRoom.ts similarity index 75% rename from src/libs/Navigation/shouldOpenOnAdminRoom.ts rename to src/libs/Navigation/helpers/shouldOpenOnAdminRoom.ts index a593e8c22768..ae316fa3fa44 100644 --- a/src/libs/Navigation/shouldOpenOnAdminRoom.ts +++ b/src/libs/Navigation/helpers/shouldOpenOnAdminRoom.ts @@ -1,4 +1,4 @@ -import getCurrentUrl from './currentUrl'; +import getCurrentUrl from '@libs/Navigation/currentUrl'; export default function shouldOpenOnAdminRoom() { const url = getCurrentUrl(); diff --git a/src/libs/Navigation/shouldPreventDeeplinkPrompt.ts b/src/libs/Navigation/helpers/shouldPreventDeeplinkPrompt.ts similarity index 100% rename from src/libs/Navigation/shouldPreventDeeplinkPrompt.ts rename to src/libs/Navigation/helpers/shouldPreventDeeplinkPrompt.ts diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 9925980d37b8..26feeb8f4a85 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -1,11 +1,10 @@ import {getActionFromState} from '@react-navigation/core'; import type {NavigationContainerRef, NavigationState, PartialState, StackActionType} from '@react-navigation/native'; import {findFocusedRoute, StackActions} from '@react-navigation/native'; -import {getMatchingFullScreenRoute, isFullScreenName} from '@libs/Navigation/linkingConfig/getAdaptedStateFromPath'; -import normalizePath from '@libs/Navigation/linkingConfig/normalizePath'; +import {getStateFromPath, normalizePath} from '@libs/Navigation/helpers'; +import {getMatchingFullScreenRoute, isFullScreenName} from '@libs/Navigation/helpers/getAdaptedStateFromPath'; import {shallowCompare} from '@libs/ObjectUtils'; import {extractPolicyIDFromPath, getPathWithoutPolicyID} from '@libs/PolicyUtils'; -import getStateFromPath from '@navigation/getStateFromPath'; import linkingConfig from '@navigation/linkingConfig'; import type {NavigationPartialRoute, ReportsSplitNavigatorParamList, RootStackParamList, StackNavigationAction} from '@navigation/types'; import CONST from '@src/CONST'; diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 3184be4a10f9..4f7e40ec39cc 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -1,11 +1,11 @@ import type {LinkingOptions} from '@react-navigation/native'; +import {createNormalizedConfigs} from '@libs/Navigation/helpers'; +import type {RouteConfig} from '@libs/Navigation/helpers'; import type {RootStackParamList} from '@navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import ROUTES from '@src/ROUTES'; import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; -import type {RouteConfig} from './createNormalizedConfigs'; -import createNormalizedConfigs from './createNormalizedConfigs'; // Moved to a separate file to avoid cyclic dependencies. const config: LinkingOptions['config'] = { diff --git a/src/libs/Navigation/linkingConfig/index.ts b/src/libs/Navigation/linkingConfig/index.ts index 3e958d593ec9..dcdd14241cff 100644 --- a/src/libs/Navigation/linkingConfig/index.ts +++ b/src/libs/Navigation/linkingConfig/index.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type {LinkingOptions} from '@react-navigation/native'; +import {customGetPathFromState} from '@libs/Navigation/helpers'; +import getAdaptedStateFromPath from '@libs/Navigation/helpers/getAdaptedStateFromPath'; import type {RootStackParamList} from '@navigation/types'; import config from './config'; -import customGetPathFromState from './customGetPathFromState'; -import getAdaptedStateFromPath from './getAdaptedStateFromPath'; import prefixes from './prefixes'; const linkingConfig: LinkingOptions = { diff --git a/src/libs/ReportActionComposeFocusManager.ts b/src/libs/ReportActionComposeFocusManager.ts index 450a6d7f5481..2967a49512ea 100644 --- a/src/libs/ReportActionComposeFocusManager.ts +++ b/src/libs/ReportActionComposeFocusManager.ts @@ -2,8 +2,8 @@ import React from 'react'; import type {MutableRefObject} from 'react'; import type {TextInput} from 'react-native'; import SCREENS from '@src/SCREENS'; -import getTopmostRouteName from './Navigation/getTopmostRouteName'; -import isReportOpenInRHP from './Navigation/isReportOpenInRHP'; +import getTopmostRouteName from './Navigation/helpers/getTopmostRouteName'; +import isReportOpenInRHP from './Navigation/helpers/isReportOpenInRHP'; import navigationRef from './Navigation/navigationRef'; type FocusCallback = (shouldFocusForNonBlurInputOnTapOutside?: boolean) => void; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 823e74fafe32..ac2407ead711 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -38,7 +38,7 @@ import GoogleTagManager from '@libs/GoogleTagManager'; import * as IOUUtils from '@libs/IOUUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as Localize from '@libs/Localize'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; import * as NextStepUtils from '@libs/NextStepUtils'; import {rand64} from '@libs/NumberUtils'; diff --git a/src/libs/actions/Welcome/OnboardingFlow.ts b/src/libs/actions/Welcome/OnboardingFlow.ts index 9b7dfc894b6a..7417a8c0b096 100644 --- a/src/libs/actions/Welcome/OnboardingFlow.ts +++ b/src/libs/actions/Welcome/OnboardingFlow.ts @@ -1,8 +1,8 @@ import {findFocusedRoute, getStateFromPath} from '@react-navigation/native'; import type {NavigationState, PartialState} from '@react-navigation/native'; import Onyx from 'react-native-onyx'; +import {getAdaptedStateFromPath} from '@libs/Navigation/helpers'; import linkingConfig from '@libs/Navigation/linkingConfig'; -import getAdaptedStateFromPath from '@libs/Navigation/linkingConfig/getAdaptedStateFromPath'; import {navigationRef} from '@libs/Navigation/Navigation'; import type {RootStackParamList} from '@libs/Navigation/types'; import CONST from '@src/CONST'; diff --git a/src/libs/navigateAfterOnboarding.ts b/src/libs/navigateAfterOnboarding.ts index d84927988b5c..494c70c907f4 100644 --- a/src/libs/navigateAfterOnboarding.ts +++ b/src/libs/navigateAfterOnboarding.ts @@ -1,7 +1,7 @@ import ROUTES from '@src/ROUTES'; import * as Report from './actions/Report'; +import {shouldOpenOnAdminRoom} from './Navigation/helpers'; import Navigation from './Navigation/Navigation'; -import shouldOpenOnAdminRoom from './Navigation/shouldOpenOnAdminRoom'; import * as ReportUtils from './ReportUtils'; const navigateAfterOnboarding = ( diff --git a/src/pages/EditReportFieldPage.tsx b/src/pages/EditReportFieldPage.tsx index 55e0207c0244..742f7f6e05b3 100644 --- a/src/pages/EditReportFieldPage.tsx +++ b/src/pages/EditReportFieldPage.tsx @@ -12,7 +12,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; import type {EditRequestNavigatorParamList} from '@libs/Navigation/types'; import * as ReportUtils from '@libs/ReportUtils'; diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index f3a98089b2b1..6e9b56a48c66 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -24,7 +24,7 @@ import usePolicy from '@hooks/usePolicy'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import isReportOpenInRHP from '@libs/Navigation/isReportOpenInRHP'; +import isReportOpenInRHP from '@libs/Navigation/helpers/isReportOpenInRHP'; import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import Parser from '@libs/Parser'; diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 5b454fa93ee4..b802ed8f9ee4 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -20,7 +20,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import DateUtils from '@libs/DateUtils'; -import isSearchTopmostFullScreenRoute from '@libs/Navigation/isSearchTopmostFullScreenRoute'; +import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index de196e4e75d8..34c056307562 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -32,7 +32,7 @@ import useWaitForNavigation from '@hooks/useWaitForNavigation'; import {resetExitSurveyForm} from '@libs/actions/ExitSurvey'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import BottomTabBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar'; -import getTopmostRouteName from '@libs/Navigation/getTopmostRouteName'; +import getTopmostRouteName from '@libs/Navigation/helpers/getTopmostRouteName'; import Navigation from '@libs/Navigation/Navigation'; import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as UserUtils from '@libs/UserUtils'; diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index e0d33c639816..b9a10be2ecb2 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -22,7 +22,7 @@ import useWaitForNavigation from '@hooks/useWaitForNavigation'; import {isConnectionInProgress} from '@libs/actions/connections'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import BottomTabBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/BottomTabBar'; -import getTopmostRouteName from '@libs/Navigation/getTopmostRouteName'; +import getTopmostRouteName from '@libs/Navigation/helpers/getTopmostRouteName'; import Navigation from '@libs/Navigation/Navigation'; import type {WorkspaceSplitNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils';