Commit 22f9bd9
authored
refactor(ProtectYourWalletModal): migrate to design system components (#27584)
## **Description**
Replaces legacy styling and icon primitives in `ProtectYourWalletModal`
with design system components, keeping the existing `PureComponent` +
`connect()` + `withAnalyticsAwareness` architecture unchanged.
**What changed (visual layer only):**
- `View` → `Box` from `@metamask/design-system-react-native`
- `StyleSheet.create()` + theme-based color styles → `twClassName`
Tailwind utilities (DS handles theming internally)
- Raw `Text` with `fontStyles` → DS `Text` with `TextVariant`,
`TextColor`, `FontWeight`
- `FontAwesome` icon + `TouchableOpacity` (close button) → DS
`ButtonIcon`
- `TouchableOpacity` + `Text` (Learn more) → DS `Button`
(`ButtonVariant.Tertiary`)
- Remove `ThemeContext` / `mockTheme` imports (no longer needed)
- Remove `fontStyles` import (no longer needed)
- PNG `require()` + `eslint-disable` comment → clean ES module import
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: <!-- no linked issue -->
## **Manual testing steps**
```gherkin
Feature: Protect Your Wallet Modal — visual regression check
Scenario: Modal renders correctly (light + dark mode)
Given the user has a wallet without a backed-up seed phrase
When the wallet home screen loads
Then the Protect Your Wallet modal appears
And the title, lock image, body text, close button, and Learn more button are visible
And the layout matches the before/after screenshots in both light and dark mode
Scenario: All interactions still work
Given the modal is visible
When user taps the X close button — modal dismisses
When user taps "Protect wallet" — navigates to backup SRP flow
When user taps "Learn more" — opens MetaMask safety tips webview
When user taps "Remind me later" — modal dismisses
```
| | Before | After |
|-------------|--------|-------|
| **Light** | <img
src="https://github.com/user-attachments/assets/58fded8f-b1e3-46c7-a2ab-a7d873268c23"
width="300"/> | <img
src="https://github.com/user-attachments/assets/d3c4ee2f-8806-4803-ab6d-2b71bdc87b3c"
width="300"/> |
| **Dark** | <img
src="https://github.com/user-attachments/assets/ff9d2404-6b35-487a-85c6-81eeafe6af9f"
width="300"/> | <img
src="https://github.com/user-attachments/assets/342f01a9-a860-49f9-ae8f-5404946dff3a"
width="300"/> |
## **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]
> **Low Risk**
> Low risk UI refactor that replaces legacy styling/components with
design-system `Box`/`Text`/`Button` variants while keeping the same
navigation and analytics flows.
>
> **Overview**
> Refactors `ProtectYourWalletModal` to use MetaMask design-system
components and Tailwind-style `twClassName` layout instead of legacy
`StyleSheet` + `View`/`TouchableOpacity` + FontAwesome close icon.
>
> The modal’s structure is preserved (same cancel/confirm handlers,
navigation targets, analytics events, and seedless-onboarding
suppression), but the header close control is now a DS `ButtonIcon`, the
“Learn more” action is a DS `Button` (`Tertiary`), and the image is
imported via ES module rather than `require()`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8571195. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 5cb34da commit 22f9bd9
1 file changed
Lines changed: 63 additions & 111 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
4 | 21 | | |
5 | | - | |
6 | 22 | | |
7 | 23 | | |
8 | | - | |
9 | 24 | | |
10 | 25 | | |
11 | 26 | | |
12 | | - | |
13 | | - | |
14 | 27 | | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
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 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 31 | + | |
74 | 32 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 33 | | |
79 | 34 | | |
80 | 35 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 36 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 37 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 38 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 39 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 40 | | |
101 | 41 | | |
102 | 42 | | |
| |||
142 | 82 | | |
143 | 83 | | |
144 | 84 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 85 | | |
150 | 86 | | |
151 | 87 | | |
| |||
164 | 100 | | |
165 | 101 | | |
166 | 102 | | |
167 | | - | |
168 | | - | |
| 103 | + | |
| 104 | + | |
169 | 105 | | |
170 | 106 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
174 | 119 | | |
175 | 120 | | |
176 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
177 | 125 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
189 | 144 | | |
190 | | - | |
| 145 | + | |
191 | 146 | | |
192 | 147 | | |
193 | 148 | | |
194 | 149 | | |
195 | | - | |
| 150 | + | |
| 151 | + | |
196 | 152 | | |
197 | 153 | | |
| 154 | + | |
198 | 155 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
204 | 159 | | |
205 | 160 | | |
206 | 161 | | |
| |||
213 | 168 | | |
214 | 169 | | |
215 | 170 | | |
216 | | - | |
217 | | - | |
| 171 | + | |
218 | 172 | | |
219 | 173 | | |
220 | | - | |
221 | | - | |
222 | 174 | | |
223 | 175 | | |
224 | 176 | | |
| |||
0 commit comments