Skip to content

chore(bridge): type Bridge navigators with feature param lists (Phase 3)#33292

Open
weitingsun wants to merge 1 commit into
mainfrom
chore/navigation-typing-phase-3-bridge
Open

chore(bridge): type Bridge navigators with feature param lists (Phase 3)#33292
weitingsun wants to merge 1 commit into
mainfrom
chore/navigation-typing-phase-3-bridge

Conversation

@weitingsun

@weitingsun weitingsun commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 of the incremental React Navigation typing migration — Bridge feature.

Bridge’s nested navigators (Bridge / BridgeModals) were loosely typed (BridgeRouteParams on the root entry / undefined for modals), so nested navigate(container, { screen, params }) calls could not be checked against real screen param shapes. Call sites already navigate with { screen, params } (e.g. into BridgeView); this PR aligns the types with that runtime pattern.

This is types-only — no intentional runtime navigation behavior change.

What changed

Feature param lists (app/components/UI/Bridge/types/navigation.ts)

  • BridgeScreensStackParamList — screen stack (BridgeScreenStack): BridgeView, token selector, batch sell flows, quote selector, hardware wallet / QR scanner
  • BridgeModalsNavigationParamList — modal stack (BridgeModalStack): slippage, block explorer, Blockaid, recipient selector, market closed, network list, price/token warnings, post-trade, batch-sell info sheets, etc.
  • BridgeNavigationParamList — feature union + nested Bridge / BridgeModals entries

Navigators (app/components/UI/Bridge/routes.tsx)

  • createNativeStackNavigator<BridgeScreensStackParamList>() for BridgeScreenStack
  • createNativeStackNavigator<BridgeModalsNavigationParamList>() for BridgeModalStack

Root stack (app/core/NavigationService/types.ts)

  • BridgeNavigatorScreenParams<BridgeScreensStackParamList> (was incorrectly BridgeRouteParams)
  • BridgeModalsNavigatorScreenParams<BridgeModalsNavigationParamList>
  • Leaf Bridge screen/modal routes now reference the feature param lists

Why

  • Improves nested Bridge navigation type-safety ahead of flipping useNavigation to strict route checking app-wide
  • Fixes the root Bridge entry type so it matches nested { screen, params } navigation already used throughout the app
  • Centralizes Bridge route params in one feature file instead of duplicating shapes in RootStackParamList
  • Matches the Phase 3 pattern already landed for other features

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-674

Manual testing steps

N/A

Screenshots/Recordings

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Compile-time-only refactor with no navigation logic changes; main risk is incorrect param typings surfacing as TypeScript errors at call sites.

Overview
Phase 3 React Navigation typing for Bridge — types only; no intended runtime navigation changes.

Adds app/components/UI/Bridge/types/navigation.ts with BridgeScreensStackParamList, BridgeModalsNavigationParamList, and BridgeNavigationParamList, consolidating screen/modal route params that were previously scattered across RootStackParamList imports.

BridgeScreenStack and BridgeModalStack now use createNativeStackNavigator with those param lists instead of untyped stacks.

In RootStackParamList, Bridge is typed as NavigatorScreenParams<BridgeScreensStackParamList> (replacing incorrect BridgeRouteParams on the root entry), BridgeModals gets NavigatorScreenParams<BridgeModalsNavigationParamList>, and flat Bridge routes are aliased from the feature lists (including HardwareWalletsSwaps on the root list).

Reviewed by Cursor Bugbot for commit f5cf5cd. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamask-ci metamask-ci Bot added the team-mobile-platform Mobile Platform team label Jul 14, 2026
@metamask-ci

metamask-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR is a TypeScript refactoring of Bridge/Swap navigation types:

  1. app/components/UI/Bridge/types/navigation.ts (new file): Consolidates all Bridge navigation param list types (BridgeScreensStackParamList, BridgeModalsNavigationParamList, BridgeNavigationParamList) into a single dedicated module. No runtime logic — pure TypeScript type definitions.

  2. app/core/NavigationService/types.ts (critical file): Refactored to import from the new consolidated types file instead of individual component files. The RootStackParamList Bridge route entries now reference the new type aliases. Minor structural change: Bridge now uses NavigatorScreenParams<BridgeScreensStackParamList> and HardwareWalletsSwaps is explicitly added. These are type-only changes.

  3. app/components/UI/Bridge/routes.tsx: Updated to use typed navigators (createNativeStackNavigator<BridgeScreensStackParamList>() and createNativeStackNavigator<BridgeModalsNavigationParamList>()). No runtime behavior change.

Risk assessment: Low. This is a pure TypeScript refactoring with no functional logic changes. The actual navigation routes, screen components, and params remain the same — only the type organization changed. However, since Bridge/Swap navigation is touched, running SmokeSwap validates the swap/bridge flow still works end-to-end. SmokeConfirmations is included per the SmokeSwap tag description (transaction confirmations are part of the swap flow).

Performance Test Selection:
This PR is a pure TypeScript type refactoring of Bridge navigation param lists. No runtime logic, rendering, or data-fetching code was changed. There is no performance impact from reorganizing TypeScript type definitions.

View GitHub Actions results

@weitingsun weitingsun marked this pull request as ready for review July 14, 2026 21:31
@weitingsun weitingsun requested review from a team as code owners July 14, 2026 21:31
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jul 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium AI analysis: medium risk size-M team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant