Skip to content

Commit 053257b

Browse files
authored
feat: Update StakeScreens with custom navigation options (MetaMask#23913)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** When selecting "Deposit" from the Trade Menu, the Deposit page was sliding in from the bottom (default modal behavior). Per design requirements, it should slide in from the right, consistent with other navigation flows. Applied the same cardStyleInterpolator pattern already used by: - Settings (Routes.SETTINGS_VIEW) - TrendingTokensFullView - ExploreSearchScreen - SitesFullView - Perps ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Updated Deposit page transition to slide in from the right instead of bottom ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MDP-235 ## **Manual testing steps** ```gherkin Feature: Deposit page navigation transition Scenario: user opens Deposit page from Trade Menu Given the user is on the Wallet home screen And the user has Deposit enabled When user taps on the Trade/Fund action button And user selects "Deposit" from the menu Then the Deposit page slides in from the right side of the screen And user can swipe from left edge to go back ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/fba1e102-92cc-4cf5-8bb5-d94bedbb48a4 <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/d18e1e5b-5b89-451d-87d5-b18446180cc9 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Configures `StakeScreens` to hide the header and use a right-to-left slide transition; updates snapshot accordingly. > > - **Navigation**: > - **`MainNavigator.js`**: Add custom options to `Stack.Screen` for `StakeScreens`: > - `headerShown: false` > - Enable right-to-left slide via `animationEnabled: true` and custom `cardStyleInterpolator`. > - **Tests**: > - Update snapshot `MainNavigator.test.tsx.snap` to reflect new `StakeScreens` options. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f185550. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 0f86a83 commit 053257b

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

app/components/Nav/Main/MainNavigator.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,26 @@ const MainNavigator = () => {
11411141
component={BridgeModalStack}
11421142
options={clearStackNavigatorOptions}
11431143
/>
1144-
<Stack.Screen name="StakeScreens" component={StakeScreenStack} />
1144+
<Stack.Screen
1145+
name="StakeScreens"
1146+
component={StakeScreenStack}
1147+
options={{
1148+
headerShown: false,
1149+
animationEnabled: true,
1150+
cardStyleInterpolator: ({ current, layouts }) => ({
1151+
cardStyle: {
1152+
transform: [
1153+
{
1154+
translateX: current.progress.interpolate({
1155+
inputRange: [0, 1],
1156+
outputRange: [layouts.screen.width, 0],
1157+
}),
1158+
},
1159+
],
1160+
},
1161+
}),
1162+
}}
1163+
/>
11451164
<Stack.Screen name={Routes.EARN.ROOT} component={EarnScreenStack} />
11461165
<Stack.Screen
11471166
name={Routes.EARN.MODALS.ROOT}

app/components/Nav/Main/__snapshots__/MainNavigator.test.tsx.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ exports[`MainNavigator matches rendered snapshot 1`] = `
196196
<Screen
197197
component={[Function]}
198198
name="StakeScreens"
199+
options={
200+
{
201+
"animationEnabled": true,
202+
"cardStyleInterpolator": [Function],
203+
"headerShown": false,
204+
}
205+
}
199206
/>
200207
<Screen
201208
component={[Function]}

0 commit comments

Comments
 (0)