Commit 12790c0
authored
refactor(predict): use native stack navigators for Predict routes (#30151)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
## **Description**
POC:
https://docs.google.com/document/d/1_oDELkGRLUgaAeMs2NSzG9w1UyjsD5VSKQlW7yW5oZU/edit?tab=t.0#heading=h.gba8s4wq9tzu
Android build:
https://github.com/MetaMask/metamask-mobile/actions/runs/25829982981
Switches Predict’s main and modal navigators from
@react-navigation/stack to @react-navigation/native-stack, aligns
modal/confirmation options with other feature stacks (e.g. Money), and
removes JS-stack-only transition customization that no longer applies.
**What changed**
PredictScreenStack: createNativeStackNavigator with screenOptions={{
headerShown: false }}; market list uses animation: 'none' instead of
animationEnabled: false.
PredictModalStack: Uses clearNativeStackNavigatorOptions +
transparentModalScreenOptions instead of clearStackNavigatorOptions +
per-screen opacity interpolators.
Confirmations: REDESIGNED_CONFIRMATIONS uses
useEmptyNavHeaderForConfirmations() (same pattern as Money); NO_HEADER
uses headerShown: false.
Removed: getConfirmationTransitionSpec, PredictConfirmationRouteParams,
getPredictConfirmationScreenOptions, slideFromRightInterpolator, and all
cardStyleInterpolator blocks on modal screens.
**Behavior notes**
Push screens (buy/sell preview, market details): rely on native stack
default push animation (slide from right on Android; system behavior on
iOS) instead of the previous manual translateX interpolator.
Transparent modals (unavailable, GTM, add funds): no longer fade the
route card via interpolator; modal/sheet UIs own their presentation;
outer stack uses transparent modal + animation: 'none' from the shared
preset.
## **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:null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<img width="382" height="768" alt="predict before part 1"
src="https://github.com/user-attachments/assets/c494c723-9913-4cbb-a9ff-c91b66d7e172"
/>
<img width="382" height="768" alt="predict before part 2"
src="https://github.com/user-attachments/assets/0897d06f-b842-4f24-abfb-0ac6167b3020"
/>
<img width="382" height="786" alt="predict before part 3"
src="https://github.com/user-attachments/assets/0b9fdefc-d434-47cf-9e41-551fe5f49e68"
/>
### **After**
<img width="382" height="786" alt="Predict after part 1"
src="https://github.com/user-attachments/assets/204b4512-294e-4dbe-8ac6-bad7b96160b2"
/>
<img width="382" height="786" alt="predict after part 2"
src="https://github.com/user-attachments/assets/5fd683bb-e7d8-4bae-b677-1cd698f39368"
/>
<img width="382" height="786" alt="predict after part 3"
src="https://github.com/user-attachments/assets/b8fc7459-6be5-4e4a-8b44-93443b0f25ef"
/>
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [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.
#### 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](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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]
> **Medium Risk**
> Changes Predict navigation stacks and screen option presets, which can
subtly alter transition behavior and header presentation across multiple
screens/modals. Risk is moderate because it’s UI/navigation-only and
doesn’t touch business logic, but regressions would impact user flow.
>
> **Overview**
> Migrates Predict’s main and modal navigators from
`@react-navigation/stack` to `@react-navigation/native-stack`,
standardizing screen options via `clearNativeStackNavigatorOptions` and
`transparentModalScreenOptions`.
>
> Removes JS-stack-only transition customizations (custom interpolators
and confirmation transitionSpec) and updates confirmation routes to use
`useEmptyNavHeaderForConfirmations` (or `headerShown: false`) while
relying on native-stack defaults for push/modal animations. Test mocks
were updated to reflect the new navigation option exports and
confirmations header hook.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
80b0c82. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 4384427 commit 12790c0
2 files changed
Lines changed: 61 additions & 156 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
5 | 2 | | |
6 | 3 | | |
7 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 25 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 26 | + | |
| 27 | + | |
70 | 28 | | |
71 | | - | |
72 | | - | |
| 29 | + | |
| 30 | + | |
73 | 31 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
140 | 37 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
144 | 68 | | |
145 | 69 | | |
146 | 70 | | |
147 | 71 | | |
148 | 72 | | |
| 73 | + | |
149 | 74 | | |
150 | 75 | | |
151 | 76 | | |
152 | 77 | | |
153 | 78 | | |
154 | 79 | | |
155 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
156 | 84 | | |
157 | 85 | | |
158 | 86 | | |
159 | 87 | | |
160 | 88 | | |
161 | | - | |
162 | | - | |
| 89 | + | |
163 | 90 | | |
164 | 91 | | |
165 | 92 | | |
166 | 93 | | |
167 | 94 | | |
168 | 95 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 96 | | |
174 | 97 | | |
175 | 98 | | |
176 | 99 | | |
177 | 100 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 101 | | |
183 | 102 | | |
184 | 103 | | |
185 | 104 | | |
186 | 105 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | 106 | | |
192 | 107 | | |
193 | 108 | | |
194 | 109 | | |
195 | 110 | | |
196 | | - | |
| 111 | + | |
197 | 112 | | |
198 | 113 | | |
199 | 114 | | |
200 | 115 | | |
201 | 116 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 117 | | |
217 | 118 | | |
218 | 119 | | |
219 | 120 | | |
220 | 121 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 122 | | |
226 | 123 | | |
227 | 124 | | |
| |||
0 commit comments