You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributingGuides/NAVIGATION.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ The navigation in the app is built on top of the `react-navigation` library. To
31
31
-[Dynamic routes with query parameters](#dynamic-routes-with-query-parameters)
32
32
-[How to add a new dynamic route](#how-to-add-a-new-dynamic-route)
33
33
-[Migrating from backTo to dynamic routes](#migrating-from-backto-to-dynamic-routes)
34
+
-[Backward compatibility for changed paths](#backward-compatibility-for-changed-paths)
34
35
-[How to remove backTo from URL (Legacy)](#how-to-remove-backto-from-url)
35
36
-[Separating routes for each screen instance](#separating-routes-for-each-screen-instance)
36
37
-[Generating state from a path](#generating-state-from-a-path)
@@ -931,6 +932,46 @@ If you are migrating an existing flow that uses `backTo` (or multiple static rou
931
932
932
933
Forthelegacyapproach (e.g. separatingroutesperscreeninstance) andedgecaseslikeRHPunderlay, see [HowtoremovebackTofromURL](#how-to-remove-backto-from-url) and [Separatingroutesforeachscreeninstance](#separating-routes-for-each-screen-instance).
933
934
935
+
### Backwardcompatibilityforchangedpaths
936
+
937
+
Whenmigratingastaticroutetoadynamicroute, theresultingURLoftenchangesbecausedynamicroutesbuildthetargetpathontopoftheentryscreen's URL. Here is a concrete example:
Becausethesuffix`settings/name`isappendedto`/r/:reportID/details`, theresultingURLnowincludestheentryscreen's path as a prefix. The old static URL (`/r/:reportID/settings/name`) no longer matches the new dynamic one (`/r/:reportID/details/settings/name`).
Eachentryin`OldRoutes.ts`mapsanoldpathpatterntothenewpath. Use`*`asawildcardfordynamicsegmentsand`$1`, `$2`, etc. inthereplacementtoreferencecapturedsegments:
// Bing search results still link to /signin when searching for “Expensify”, but the /signin route no longer exists in our repo, so we redirect it to the home page to avoid showing a Not Found page.
0 commit comments