Skip to content

chore: migrate StackNavigationProp types to native-stack equivalents#32119

Draft
weitingsun wants to merge 6 commits into
mainfrom
wsun/clean-up-react-navigation-stack
Draft

chore: migrate StackNavigationProp types to native-stack equivalents#32119
weitingsun wants to merge 6 commits into
mainfrom
wsun/clean-up-react-navigation-stack

Conversation

@weitingsun

@weitingsun weitingsun commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Replaces remaining @react-navigation/stack type usage with native-stack-aligned types now that the app runs on createNativeStackNavigator. This PR is type-only for production code — no navigator or screen transition behavior changes.

  • Migrate StackNavigationProp call sites to AppNavigationProp, NavigationProp, or NativeStackNavigationProp as appropriate
  • Update AppNavigationProp to extend NativeStackNavigationProp so stack APIs (replace, push, pop) type-check correctly
  • Update test/storybook render helpers to use createNativeStackNavigator

Changelog

CHANGELOG entry:null

Related issues

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

Manual testing steps

N/A - the changes are limited to tests and type changes, no functional changes

Screenshots/Recordings

n/a

Before

After

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
Mostly TypeScript and test infrastructure; the ramps settings callback is a small UX timing change with no auth or transaction impact.

Overview
Aligns remaining navigation typing and test harnesses with native stack now that the main app uses createNativeStackNavigator.

Production screens and hooks stop importing StackNavigationProp from @react-navigation/stack and instead use AppNavigationProp (general navigation), AppStackNavigationProp (stack APIs like replace/pop), NativeStackNavigationProp where a feature param list is scoped (e.g. Predict), or NavigationProp for typed sub-stacks (e.g. ramps). NavigationService/types adds AppStackNavigationProp as the typed native-stack variant with the same safe getState() override as AppNavigationProp.

Tests, Storybook, and shared render helpers swap createStackNavigator for createNativeStackNavigator and drop redundant stack mocks where native-stack is mocked instead. testSetup.js mocks react-native-screens so native-stack navigators unmount cleanly under Jest.

The only non-type production behavior change is in ramps settings: “View order history” now navigates inside the bottom sheet close callback so navigation runs after the sheet dismisses.

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

@weitingsun weitingsun self-assigned this Jun 19, 2026
@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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-mobile-platform Mobile Platform team label Jun 19, 2026
@mm-token-exchange-service

mm-token-exchange-service Bot commented Jun 19, 2026

Copy link
Copy Markdown

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.

@weitingsun weitingsun marked this pull request as ready for review June 19, 2026 18:40
@weitingsun weitingsun requested review from a team as code owners June 19, 2026 18:40
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 19, 2026
…aMask/metamask-mobile into wsun/clean-up-react-navigation-stack
@weitingsun weitingsun requested a review from a team as a code owner June 19, 2026 19:17
@github-actions github-actions Bot added risk:low AI analysis: low risk and removed risk:medium AI analysis: medium risk labels Jun 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations, SmokeMoney, SmokeStake, SmokePredictions, SmokeWalletPlatform, SmokeAccounts, SmokeNetworkAbstractions
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: high
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR migrates navigation from @react-navigation/stack (JS-based) to @react-navigation/native-stack (native-based) across a wide range of components. This is a significant infrastructure change that affects navigation behavior across many user flows.

Key changes analyzed:

  1. Navigation type migration: StackNavigationPropAppNavigationProp/AppStackNavigationProp across Bridge, Ramp, Money, Confirmations, Predict, Earn, Trending, Card, DeFi, Social components.

  2. Test infrastructure: renderWithProvider.tsx, testSetup.js, and component-view renderers all migrated to native stack. The testSetup.js adds a react-native-screens mock to prevent crashes in Jest.

  3. Functional behavioral change in SettingsModal.tsx: Navigation to TRANSACTIONS_VIEW now happens inside onCloseBottomSheet() callback (after close animation completes), rather than immediately. This is a real behavioral change that could affect the Ramp/Money flow.

  4. Bridge/Swap modals: BatchSellFinalReviewModal, BatchSellMinimumReceivedInfoModal, BatchSellNetworkFeeInfoModal, BatchSellQuoteDetailsModal, TokenWarningModal, MissingPriceModal all updated.

  5. Confirmations: useClearConfirmationOnBackSwipe updated - this hook handles back-swipe behavior in confirmation screens.

  6. ManualBackupStep1 types: Changed from StackNavigationProp to NavigationProp - affects SRP backup flow.

Tags selected:

  • SmokeSwap: Bridge/swap modals (BatchSell*, TokenWarning, MissingPrice) are core to swap/bridge flows
  • SmokeConfirmations: useClearConfirmationOnBackSwipe directly affects confirmation back-swipe behavior; also required by SmokeSwap
  • SmokeMoney: Ramp SettingsModal (functional change), MoneyOnboarding, MoneyFirstTimeDeposit, useTransakRouting, ErrorDetailsModal all changed
  • SmokeStake: EarnMusdConversionEducationView navigation changed
  • SmokePredictions: usePredictBuyActions navigation type changed
  • SmokeWalletPlatform: Trending useTokenListFilters, TopTradersSection, TraderPositionView navigation changed; also required by SmokeMoney
  • SmokeAccounts: ManualBackupStep1 navigation type changed (SRP backup flow)
  • SmokeNetworkAbstractions: DeFiProtocolPositionDetails navigation changed; broad navigation infrastructure change

The native stack navigator has different transition animations, gesture handling, and header behavior compared to the JS stack navigator. The useClearConfirmationOnBackSwipe hook specifically handles swipe-to-dismiss gestures which may behave differently with native stack.

Performance Test Selection:
The changes are a navigation library migration (stack → native-stack) and type system updates. While native-stack is generally more performant than JS-stack, the PR doesn't modify any performance-sensitive rendering paths, asset loading, account list rendering, onboarding flows, login flows, or swap execution flows in ways that would meaningfully change measured performance metrics. The changes are primarily TypeScript type annotations and navigator constructor calls. No performance test tags are warranted.

View GitHub Actions results

@weitingsun weitingsun marked this pull request as draft June 20, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant