Skip to content

Commit 208c27b

Browse files
authored
feat: migrate ListItem to DSRN usage (#28878)
<!-- 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** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> Migrated `ListItem` component as part of pilot migration. ## **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: https://consensyssoftware.atlassian.net/browse/DSYS-280 ## **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** https://github.com/user-attachments/assets/afc628d9-29a8-458f-a524-48ac0f90b651 ### **After** https://github.com/user-attachments/assets/865bbc0a-6a2c-4cf8-82fa-fe6d7cc61101 ## **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. #### 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** - [ ] 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** > UI-only component migration with snapshot updates; main risk is minor layout/spacing/accessibility regressions in the settings drawer rows. > > **Overview** > Migrates `SettingsDrawer` from legacy list components (`ListItemColumn`/`WidthType`) to `@metamask/design-system-react-native` primitives (`ListItem` + `Box`) while preserving the same content structure (title/description/warning and optional arrow). > > Updates the `DefaultSettings` onboarding success Jest snapshot to reflect the new rendered tree/styles from the DSRN components. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 02bc58c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent e0a6b8c commit 208c27b

2 files changed

Lines changed: 132 additions & 62 deletions

File tree

app/components/UI/SettingsDrawer/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import Icon, {
99
IconName,
1010
IconSize,
1111
} from '../../../component-library/components/Icons/Icon';
12-
import ListItem from '../../../component-library/components/List/ListItem/ListItem';
13-
import ListItemColumn, {
14-
WidthType,
15-
} from '../../../component-library/components/List/ListItemColumn';
12+
import {
13+
Box,
14+
BoxFlexDirection,
15+
ListItem,
16+
} from '@metamask/design-system-react-native';
1617
import Text, {
1718
TextVariant,
1819
TextColor,
@@ -97,7 +98,7 @@ const SettingsDrawer = ({
9798
return (
9899
<TouchableOpacity onPress={onPress} {...generateTestId(Platform, testID)}>
99100
<ListItem style={styles.root} gap={16}>
100-
<ListItemColumn widthType={WidthType.Fill}>
101+
<Box flexDirection={BoxFlexDirection.Column} twClassName="flex-1">
101102
<Text variant={TextVariant.BodyLGMedium} color={titleColor}>
102103
{title}
103104
</Text>
@@ -122,15 +123,15 @@ const SettingsDrawer = ({
122123
</Text>
123124
</View>
124125
)}
125-
</ListItemColumn>
126+
</Box>
126127
{renderArrowRight && (
127-
<ListItemColumn>
128+
<Box>
128129
<Icon
129130
style={styles.action}
130131
size={IconSize.Md}
131132
name={IconName.ArrowRight}
132133
/>
133-
</ListItemColumn>
134+
</Box>
134135
)}
135136
</ListItem>
136137
</TouchableOpacity>

app/components/Views/OnboardingSuccess/DefaultSettings/__snapshots__/index.test.tsx.snap

Lines changed: 123 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,51 @@ exports[`DefaultSettings should render correctly 1`] = `
6464
onPress={[Function]}
6565
>
6666
<View
67-
accessibilityRole="none"
68-
accessible={true}
6967
style={
70-
{
71-
"backgroundColor": "#ffffff",
72-
"padding": 16,
73-
}
68+
[
69+
{
70+
"display": "flex",
71+
},
72+
[
73+
{
74+
"paddingBottom": 16,
75+
"paddingLeft": 16,
76+
"paddingRight": 16,
77+
"paddingTop": 16,
78+
},
79+
{
80+
"backgroundColor": "#ffffff",
81+
"padding": 16,
82+
},
83+
],
84+
]
7485
}
7586
>
7687
<View
7788
style={
78-
{
79-
"alignItems": "center",
80-
"flexDirection": "row",
81-
}
89+
[
90+
{
91+
"alignItems": "center",
92+
"display": "flex",
93+
"flexDirection": "row",
94+
},
95+
undefined,
96+
]
8297
}
8398
>
8499
<View
85100
style={
86-
{
87-
"flex": 1,
88-
}
101+
[
102+
{
103+
"display": "flex",
104+
"flexBasis": "0%",
105+
"flexDirection": "column",
106+
"flexGrow": 1,
107+
"flexShrink": 1,
108+
},
109+
undefined,
110+
]
89111
}
90-
testID="listitemcolumn"
91112
>
92113
<Text
93114
accessibilityRole="text"
@@ -129,11 +150,13 @@ exports[`DefaultSettings should render correctly 1`] = `
129150
/>
130151
<View
131152
style={
132-
{
133-
"flex": -1,
134-
}
153+
[
154+
{
155+
"display": "flex",
156+
},
157+
undefined,
158+
]
135159
}
136-
testID="listitemcolumn"
137160
>
138161
<SvgMock
139162
color="#131416"
@@ -157,30 +180,51 @@ exports[`DefaultSettings should render correctly 1`] = `
157180
onPress={[Function]}
158181
>
159182
<View
160-
accessibilityRole="none"
161-
accessible={true}
162183
style={
163-
{
164-
"backgroundColor": "#ffffff",
165-
"padding": 16,
166-
}
184+
[
185+
{
186+
"display": "flex",
187+
},
188+
[
189+
{
190+
"paddingBottom": 16,
191+
"paddingLeft": 16,
192+
"paddingRight": 16,
193+
"paddingTop": 16,
194+
},
195+
{
196+
"backgroundColor": "#ffffff",
197+
"padding": 16,
198+
},
199+
],
200+
]
167201
}
168202
>
169203
<View
170204
style={
171-
{
172-
"alignItems": "center",
173-
"flexDirection": "row",
174-
}
205+
[
206+
{
207+
"alignItems": "center",
208+
"display": "flex",
209+
"flexDirection": "row",
210+
},
211+
undefined,
212+
]
175213
}
176214
>
177215
<View
178216
style={
179-
{
180-
"flex": 1,
181-
}
217+
[
218+
{
219+
"display": "flex",
220+
"flexBasis": "0%",
221+
"flexDirection": "column",
222+
"flexGrow": 1,
223+
"flexShrink": 1,
224+
},
225+
undefined,
226+
]
182227
}
183-
testID="listitemcolumn"
184228
>
185229
<Text
186230
accessibilityRole="text"
@@ -222,11 +266,13 @@ exports[`DefaultSettings should render correctly 1`] = `
222266
/>
223267
<View
224268
style={
225-
{
226-
"flex": -1,
227-
}
269+
[
270+
{
271+
"display": "flex",
272+
},
273+
undefined,
274+
]
228275
}
229-
testID="listitemcolumn"
230276
>
231277
<SvgMock
232278
color="#131416"
@@ -250,30 +296,51 @@ exports[`DefaultSettings should render correctly 1`] = `
250296
onPress={[Function]}
251297
>
252298
<View
253-
accessibilityRole="none"
254-
accessible={true}
255299
style={
256-
{
257-
"backgroundColor": "#ffffff",
258-
"padding": 16,
259-
}
300+
[
301+
{
302+
"display": "flex",
303+
},
304+
[
305+
{
306+
"paddingBottom": 16,
307+
"paddingLeft": 16,
308+
"paddingRight": 16,
309+
"paddingTop": 16,
310+
},
311+
{
312+
"backgroundColor": "#ffffff",
313+
"padding": 16,
314+
},
315+
],
316+
]
260317
}
261318
>
262319
<View
263320
style={
264-
{
265-
"alignItems": "center",
266-
"flexDirection": "row",
267-
}
321+
[
322+
{
323+
"alignItems": "center",
324+
"display": "flex",
325+
"flexDirection": "row",
326+
},
327+
undefined,
328+
]
268329
}
269330
>
270331
<View
271332
style={
272-
{
273-
"flex": 1,
274-
}
333+
[
334+
{
335+
"display": "flex",
336+
"flexBasis": "0%",
337+
"flexDirection": "column",
338+
"flexGrow": 1,
339+
"flexShrink": 1,
340+
},
341+
undefined,
342+
]
275343
}
276-
testID="listitemcolumn"
277344
>
278345
<Text
279346
accessibilityRole="text"
@@ -315,11 +382,13 @@ exports[`DefaultSettings should render correctly 1`] = `
315382
/>
316383
<View
317384
style={
318-
{
319-
"flex": -1,
320-
}
385+
[
386+
{
387+
"display": "flex",
388+
},
389+
undefined,
390+
]
321391
}
322-
testID="listitemcolumn"
323392
>
324393
<SvgMock
325394
color="#131416"

0 commit comments

Comments
 (0)