Skip to content

Commit 83638a3

Browse files
Merge branch 'main' into twisterdotcom-patch-3
2 parents d072d0c + f223c8f commit 83638a3

6 files changed

Lines changed: 1072 additions & 115 deletions

File tree

contributingGuides/NAVIGATION.md

Lines changed: 1024 additions & 114 deletions
Large diffs are not rendered by default.

src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function AnchorRenderer({tnode, style, key}: AnchorRendererProps) {
9696
linkStyle = [
9797
styles.link,
9898
{
99-
fontSize: styles.formError.fontSize,
99+
fontSize: styles.textMicro.fontSize,
100100
textDecorationLine: 'underline',
101101
},
102102
];

src/libs/Navigation/AppNavigator/createSplitNavigator/SplitRouter.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ function getRoutePolicyID(route: NavigationPartialRoute): string | undefined {
2424
return (route?.params as Record<string, string> | undefined)?.policyID;
2525
}
2626

27+
/**
28+
* Adapts the navigation state of a SplitNavigator to ensure proper screen layout and navigation flow.
29+
* This function handles both narrow and wide layouts, ensuring that:
30+
* 1. On narrow layout, it manages sidebar visibility appropriately
31+
* 2. On wide layout, it ensures both sidebar and central screens are present
32+
* 3. Handles policy-specific navigation states
33+
*
34+
* For detailed information about SplitNavigator state adaptation and navigation patterns,
35+
* see the NAVIGATION.md documentation.
36+
*
37+
* @param state - The current navigation state to adapt
38+
* @param options - Configuration options including sidebarScreen, defaultCentralScreen, and parentRoute
39+
*/
2740
function adaptStateIfNecessary({state, options: {sidebarScreen, defaultCentralScreen, parentRoute}}: AdaptStateIfNecessaryArgs) {
2841
const isNarrowLayout = getIsNarrowLayout();
2942
const rootState = navigationRef.getRootState();

src/libs/Navigation/Navigation.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ function isActiveRoute(routePath: Route): boolean {
180180
/**
181181
* Navigates to a specified route.
182182
* Main navigation method for redirecting to a route.
183+
* For detailed information about moving between screens,
184+
* see the NAVIGATION.md documentation.
183185
*
184186
* @param route - The route to navigate to.
185187
* @param options - Optional navigation options.
@@ -326,6 +328,9 @@ function goUp(backToRoute: Route, options?: GoBackOptions) {
326328
}
327329

328330
/**
331+
* Navigate back to the previous screen or a specified route.
332+
* For detailed information about navigation patterns and best practices,
333+
* see the NAVIGATION.md documentation.
329334
* @param backToRoute - Fallback route if pop/goBack action should, but is not possible within RHP
330335
* @param options - Optional configuration that affects navigation logic
331336
*/
@@ -347,6 +352,11 @@ function goBack(backToRoute?: Route, options?: GoBackOptions) {
347352
navigationRef.current?.goBack();
348353
}
349354

355+
/**
356+
* Navigate back to the sidebar screen in SplitNavigator and pop all central screens from the navigator at the same time.
357+
* For detailed information about moving between screens,
358+
* see the NAVIGATION.md documentation.
359+
*/
350360
function popToSidebar() {
351361
setShouldPopToSidebar(false);
352362

@@ -537,6 +547,8 @@ function getReportRouteByID(reportID?: string, routes: NavigationRoute[] = navig
537547

538548
/**
539549
* Closes the modal navigator (RHP, onboarding).
550+
* For detailed information about dismissing modals,
551+
* see the NAVIGATION.md documentation.
540552
*/
541553
const dismissModal = (ref = navigationRef) => {
542554
isNavigationReady().then(() => {
@@ -546,6 +558,8 @@ const dismissModal = (ref = navigationRef) => {
546558

547559
/**
548560
* Dismisses the modal and opens the given report.
561+
* For detailed information about dismissing modals,
562+
* see the NAVIGATION.md documentation.
549563
*/
550564
const dismissModalWithReport = (
551565
{reportID, reportActionID, referrer, moneyRequestReportActionID, transactionID, backTo}: ReportsSplitNavigatorParamList[typeof SCREENS.REPORT],

src/libs/Navigation/helpers/getAdaptedStateFromPath.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ function getAdaptedState(state: PartialState<NavigationState<RootNavigatorParamL
210210
return state;
211211
}
212212

213+
/**
214+
* Generate a navigation state from a given path, adapting it to handle cases like onboarding flow,
215+
* displaying RHP screens and navigating in the Workspaces tab.
216+
* For detailed information about generating state from a path,
217+
* see the NAVIGATION.md documentation.
218+
*
219+
* @param path - The path to generate state from
220+
* @param options - Extra options to fine-tune how to parse the path
221+
* @param shouldReplacePathInNestedState - Whether to replace the path in nested state
222+
* @returns The adapted navigation state
223+
* @throws Error if unable to get state from path
224+
*/
213225
const getAdaptedStateFromPath: GetAdaptedStateFromPath = (path, options, shouldReplacePathInNestedState = true) => {
214226
const normalizedPath = !path.startsWith('/') ? `/${path}` : path;
215227

src/libs/Navigation/linkingConfig/RELATIONS/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ import SIDEBAR_TO_RHP from './SIDEBAR_TO_RHP';
55
import SIDEBAR_TO_SPLIT from './SIDEBAR_TO_SPLIT';
66
import WORKSPACE_TO_RHP from './WORKSPACE_TO_RHP';
77

8+
/**
9+
* This module manages the relationships between different fullscreen navigators and screens in the app.
10+
* It defines how screens in fullscreen navigator relate to screens in another navigator, particularly
11+
* for handling RHP (Right Hand Panel) navigation.
12+
*
13+
* For detailed information about setting the correct screen underneath RHP,
14+
* see the NAVIGATION.md documentation.
15+
*/
816
function createInverseRelation<T extends string, K extends string>(relations: Partial<Record<T, K | K[]>>): Record<K, T> {
917
const reversedRelations = {} as Record<K, T>;
1018

0 commit comments

Comments
 (0)