-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Hold on react-navigation 8 bump] Remove custom addPushParamsRouterExtension #85567
Copy link
Copy link
Open
Labels
MonthlyKSv2KSv2
Description
Summary
The addPushParamsRouterExtension in src/libs/Navigation/AppNavigator/routerExtensions/addPushParamsRouterExtension.ts is a custom router extension that maintains a separate history stack of route snapshots, enabling back-navigation through param changes without requiring additional routes. This was built as a workaround because React Navigation 7 (currently on 7.1.10) doesn't natively support pushing params onto the history stack.
React Navigation 8 has built-in support for a PUSH_PARAMS-like action, making this custom extension unnecessary after upgrade.
What needs to happen
After upgrading to React Navigation 8:
- Remove
addPushParamsRouterExtension.tsand its associated types (PushParamsActionType,PushParamsRouterAction,CustomHistoryEntryinrouterExtensions/types.ts) and utility (enhanceStateWithHistoryinrouterExtensions/utils.ts) - Update
src/libs/Navigation/AppNavigator/createSearchFullscreenNavigator/index.tsxto use React Navigation 8's native PUSH_PARAMS-equivalent instead of the customcreateRouter: addPushParamsRouterExtension(SearchFullscreenRouter) - Update
SearchPageTabSelector(and any other callers dispatchingPUSH_PARAMSactions) to use the native API - Remove or update the
CONST.NAVIGATION.ACTION_TYPE.PUSH_PARAMSconstant - Remove the unit tests at
tests/unit/Navigation/routerExtensions/addPushParamsRouterExtension.test.ts(or rewrite them against the native API if warranted) - Update the export in
routerExtensions/index.ts
Context
- Introduced in PR Replace popover menu with scrollable tabs on Reports screen #84036 (scrollable tabs on Reports screen)
- The extension is currently scoped to the
SearchFullscreenNavigatoronly (see the NOTE in the JSDoc: "The PUSH_PARAMS approach is heuristic and only works in the current setup for the SearchFullscreenNavigator")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
MonthlyKSv2KSv2