refactor(stake): use native stack navigators for Stake routes#30220
Conversation
|
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a2c1345. Configure here.
Matt561
left a comment
There was a problem hiding this comment.
@weitingsun When testing, the withdrawal screen (staking and lending) renders with iOS' "glass" buttons in the header.
this is a great find @Matt561 it only happens on 17 pro max. Should be resolved now that another PR is merged in to change the nav header to HeaderStandard: #30281
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes directly affect the staking and lending flows tested by Performance Test Selection: |
|
Matt561
left a comment
There was a problem hiding this comment.
I'm not seeing the glass header icons anymore on the Unstake/Withdrawal screen 👍





Description
note to reviewer: please view the diff with the link to reduce noise: https://github.com/MetaMask/metamask-mobile/pull/30220/changes?w=1
Migrates the Stake screen and modal navigators from @react-navigation/stack to @react-navigation/native-stack(POC), and replaces getStakingNavbar + useEffect(setOptions(...)) with an in-screen HeaderStandard on three Stake flows.
Why: Setting headers via useEffect + setOptions on native stack causes a visible flicker on first paint (the default native header renders, then is replaced); for these screens we now configure headerShown: false at the route level and render the header in-screen with HeaderStandard, which eliminates the flicker.
What changed
StakeConfirmationView, UnstakeConfirmationView, StakeEarningsHistoryView: replaced legacy header setup with HeaderStandard; back button preserves the existing analytics events (STAKE_CONFIRMATION_BACK_CLICKED, UNSTAKE_CONFIRMATION_BACK_CLICKED) via useAnalytics.
Note I am leaving migration EarnWithDrawInputView.tsx out on purpose because this navbar has more logic so it's better for the team to do the migration
UnstakeConfirmationView.styles.ts: mainContainer height: '100%' → flex: 1 so the footer (Cancel / Continue) lays out correctly under the new flex parent + HeaderStandard.
EarnInputView: removed the now-redundant useEffect(() => navigation.setOptions({ headerShown: false })) (the route owns it).
Tests: navigation mocks now include goBack; StakeEarningsHistoryView.test.tsx was rewritten to assert on the rendered header title instead of setOptions / getStakingNavbar (which the screen no longer calls).
Android test build: https://github.com/MetaMask/metamask-mobile/actions/runs/25891826048
Changelog
CHANGELOG entry:null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Please note that some of these flows are not representing what app is behaving right now. I hardcoded some of the screens to see the navigation behaviours
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Refactors Stake navigation and header rendering, which can impact screen transitions/back behavior and modal presentation; mitigated by updated tests covering back actions and header titles.
Overview
Stake navigation is migrated to native-stack.
Stake/routesswitches from@react-navigation/stackto@react-navigation/native-stack, applies native-stack modal presets (clearNativeStackNavigatorOptions+transparentModalScreenOptions), and setsheaderShown: falseon Stake-related screens to avoid native header flicker.Stake headers are now rendered in-screen.
StakeConfirmationView,UnstakeConfirmationView, andStakeEarningsHistoryViewreplacesetOptions(getStakingNavbar(...))withHeaderStandard, including explicit back handlers that preserve existing MetaMetrics back-click events;UnstakeConfirmationViewlayout is adjusted (height: '100%'→flex: 1) to fit the new wrapper.Tests are updated accordingly. View tests now assert rendered header titles and verify
goBack+ analytics tracking viaHeaderStandardback button test IDs, andEarnInputViewremoves a redundantnavigation.setOptions({ headerShown: false })now handled at the route level.Reviewed by Cursor Bugbot for commit 0c8c21d. Bugbot is set up for automated code reviews on this repo. Configure here.