Skip to content

[Hold on react-navigation 8 bump] Remove custom addPushParamsRouterExtension #85567

@adamgrzybowski

Description

@adamgrzybowski

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:

  1. Remove addPushParamsRouterExtension.ts and its associated types (PushParamsActionType, PushParamsRouterAction, CustomHistoryEntry in routerExtensions/types.ts) and utility (enhanceStateWithHistory in routerExtensions/utils.ts)
  2. Update src/libs/Navigation/AppNavigator/createSearchFullscreenNavigator/index.tsx to use React Navigation 8's native PUSH_PARAMS-equivalent instead of the custom createRouter: addPushParamsRouterExtension(SearchFullscreenRouter)
  3. Update SearchPageTabSelector (and any other callers dispatching PUSH_PARAMS actions) to use the native API
  4. Remove or update the CONST.NAVIGATION.ACTION_TYPE.PUSH_PARAMS constant
  5. Remove the unit tests at tests/unit/Navigation/routerExtensions/addPushParamsRouterExtension.test.ts (or rewrite them against the native API if warranted)
  6. Update the export in routerExtensions/index.ts

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions