Skip to content

chore(card): type Card navigators with feature param lists (Phase 3)#33283

Merged
weitingsun merged 1 commit into
mainfrom
chore/navigation-typing-phase-3-card
Jul 15, 2026
Merged

chore(card): type Card navigators with feature param lists (Phase 3)#33283
weitingsun merged 1 commit into
mainfrom
chore/navigation-typing-phase-3-card

Conversation

@weitingsun

@weitingsun weitingsun commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 of the incremental React Navigation typing migration — Card feature.
Card’s nested navigators (CardScreens / CardModals) were still loosely typed (undefined / NestedNavigationParams), so nested navigate(container, { screen, params }) calls for Card could not be checked against real screen param shapes. This PR introduces feature-level param lists and wires them into the Card navigators and RootStackParamList, following the same pattern used for Perps / Rewards / Predict.
This is types-only — no intentional runtime navigation behavior change.

What changed

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

  • CardScreensStackParamList — main stack screens (MainRoutes): Home, Welcome, ChooseYourCard, ReviewOrder, OrderCompleted, Cashback, CreditRedeem, Authentication, SpendingLimit, Onboarding
  • CardModalsNavigationParamList — modal stack screens (CardModalsRoutes)
  • CardRootParamList — outer CardRoutes stack (CardHome → nested main stack, CardModals → modal stack)
  • CardNavigationParamList — feature union + nested CardScreens / CardModals entries

Navigators (app/components/UI/Card/routes/index.tsx)

  • Split the previously shared untyped Stack into typed ScreensStack (CardScreensStackParamList) and RootStack (CardRootParamList)
  • Kept ModalsStack typed with CardModalsNavigationParamList

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

  • CardScreensNavigatorScreenParams<CardRootParamList>
  • CardModalsNavigatorScreenParams<CardModalsNavigationParamList>
  • Leaf Card screen/modal routes now reference the feature param lists instead of ad-hoc / undefined shapes

Call-site cleanup

  • Exported modal param types from AddFunds / AssetSelection / RegionSelector / ConfirmModal / Password bottom sheets so the modal param list stays in sync with what each screen reads

Changelog

CHANGELOG entry:null

Related issues

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

Manual testing steps

n/a type changes only

Screenshots/Recordings

n/a type changes only

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 navigation typing and export visibility changes; no deliberate behavior changes, though stricter param types may surface existing navigate() mismatches at build time.

Overview
Phase 3 adds strict React Navigation typing for Card, matching the Perps / Rewards / Predict pattern. There is no intended runtime navigation change.

A new app/components/UI/Card/types/navigation.ts defines CardScreensStackParamList, CardModalsNavigationParamList, CardRootParamList, and CardNavigationParamList, with screen params pulled from existing view/modal types (and newly exported modal param interfaces on Add Funds, Asset Selection, Region Selector, Confirm, and Password sheets).

In Card/routes/index.tsx, the shared untyped stack is split into typed ScreensStack, RootStack, and ModalsStack; spendingLimitScreenOptions now keys off CardScreensStackParamList['CardSpendingLimit'] (including broader flow values such as enable_card).

RootStackParamList in NavigationService/types.ts now types CardScreens / CardModals with NavigatorScreenParams<…> and points leaf Card routes at the feature lists instead of undefined, loose NestedNavigationParams, or duplicated ad-hoc shapes (e.g. CardConfirmModal, ChooseYourCard, OrderCompleted).

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

@weitingsun weitingsun marked this pull request as ready for review July 14, 2026 19:27
@weitingsun weitingsun requested review from a team as code owners July 14, 2026 19:27
@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: SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a TypeScript type refactoring for the Card feature's navigation system. The changes are:

  1. New app/components/UI/Card/types/navigation.ts: Creates centralized typed navigation param lists (CardScreensStackParamList, CardModalsNavigationParamList, CardRootParamList) for the Card feature.

  2. app/core/NavigationService/types.ts (CRITICAL): Refactors RootStackParamList to use the new centralized Card navigation types instead of inline undefined or ad-hoc type definitions. This is a structural improvement — Card route params are now properly typed rather than undefined.

  3. app/components/UI/Card/routes/index.tsx: Adds TypeScript generics to the navigator stack constructors for type safety.

  4. Five Card component files: Each exports a previously-private interface (AddFundsModalNavigationDetails, AssetSelectionModalNavigationDetails, ConfirmModalParams, RegionSelectorModalParams, PasswordBottomSheetParams) so they can be imported by the new navigation types file.

Why only SmokeMoney: All changes are TypeScript-only (types/interfaces/generics). TypeScript types are erased at runtime, so there are no functional behavior changes. The Card feature is the only affected area. SmokeMoney covers Card home screen, navbar entry, Add Funds (Deposit/Swap paths), Advanced Card Management, and card analytics — exactly the flows that use the Card navigation stack being refactored. No other feature areas (confirmations, swaps, accounts, networks, etc.) are affected by these changes.

Why not more tags: The NavigationService/types.ts change is critical-flagged but the actual diff only restructures Card-specific type imports — it doesn't change any non-Card route types or navigation logic. No runtime navigation behavior is modified. The risk of regression outside Card is negligible.

Performance Test Selection:
All changes in this PR are TypeScript type definitions and interface exports — purely compile-time constructs with zero runtime impact. No performance-sensitive code paths (rendering, data fetching, state management, animations) are modified. No performance test tags are warranted.

View GitHub Actions results

@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jul 14, 2026
@weitingsun weitingsun enabled auto-merge July 14, 2026 19:31
@sonarqubecloud

Copy link
Copy Markdown

@Cal-L Cal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weitingsun weitingsun added this pull request to the merge queue Jul 15, 2026
@weitingsun weitingsun self-assigned this Jul 15, 2026
Merged via the queue into main with commit 81d497c Jul 15, 2026
220 of 221 checks passed
@weitingsun weitingsun deleted the chore/navigation-typing-phase-3-card branch July 15, 2026 19:18
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
@metamask-ci metamask-ci Bot added the release-8.4.0 Issue or pull request that will be included in release 8.4.0 label Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.4.0 Issue or pull request that will be included in release 8.4.0 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.

2 participants