Skip to content

Commit 543e138

Browse files
authored
feat: migrate WalletCreationError screens to design system (#27613)
<!-- 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** Migrates the WalletCreationError screens (SocialLoginErrorSheet and SRPErrorScreen) from legacy StyleSheet.create() styling to the MetaMask design system with Tailwind CSS. Changes: * Replaced View with Box from @metamask/design-system-react-native * Replaced component-library Text with design system Text using corrected variants (HeadingMd, BodyMd, BodySm) and semantic colors (PrimaryDefault, TextAlternative, ErrorDefault) * Replaced component-library Icon with design system Icon using corrected colors (ErrorDefault, InfoDefault) * Replaced TextVariant.BodyMDMedium with TextVariant.BodyMd + FontWeight.Medium * Replaced useStyles(styleSheet) with useTailwind() and twClassName props * Styled SafeAreaView and ScrollView via tw.style() for non-Box components Jira: https://consensyssoftware.atlassian.net/browse/TO-599 <!-- 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? --> ## **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: Wallet Creation Error Screens Scenario: user encounters social login wallet creation error Given the user is on the onboarding flow with metrics enabled When wallet creation fails during social login Then the SocialLoginErrorSheet displays with fox logo, error title, description with MetaMask Support link, and a Try again button And tapping Try again deletes the wallet and resets to onboarding And tapping MetaMask Support opens the support URL Scenario: user encounters SRP wallet creation error Given the user is on the onboarding flow with metrics disabled When wallet creation fails during SRP import or password setup Then the SRPErrorScreen displays with error title, info banner with support link, error report details, Copy button, Send error report button, and Try again button And tapping Copy copies the error report to clipboard and shows "Copied" feedback And tapping Send error report sends the error to Sentry and navigates back with a toast And tapping Try again deletes the wallet and resets to onboarding ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="303" height="640" alt="Screenshot 2026-03-18 at 7 22 48 PM" src="https://github.com/user-attachments/assets/bd4936eb-9125-4c32-a17e-7803b1105c92" /> <img width="303" height="640" alt="Screenshot 2026-03-18 at 7 23 22 PM" src="https://github.com/user-attachments/assets/cfe65237-55fe-4f56-a0fc-facf26a42874" /> <!-- [screenshots/recordings] --> ### **After** <img width="303" height="640" alt="Screenshot 2026-03-18 at 7 17 43 PM" src="https://github.com/user-attachments/assets/246f8205-9d59-40b1-9c37-0a3bf6f53117" /> <img width="303" height="640" alt="Screenshot 2026-03-18 at 7 18 49 PM" src="https://github.com/user-attachments/assets/1748c481-5de8-4c6d-bbac-592cf493f0b0" /> <!-- [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] > **Low Risk** > Primarily a UI/styling refactor to design-system components and Tailwind classes, with minimal behavioral change. Risk is limited to potential layout/visual regressions or minor prop/variant mismatches on these error screens. > > **Overview** > Migrates the `WalletCreationError` UI (`SRPErrorScreen` and `SocialLoginErrorSheet`) from legacy `StyleSheet`/`useStyles` and component-library `Text`/`Icon` to the MetaMask design system (`Box`, design-system `Text`/`Icon`) with Tailwind-based styling via `useTailwind()`. > > Deletes the dedicated `.styles.ts` files and updates typography/color usage to design-system variants/semantic tokens (including `FontWeight.Medium` for the SRP error report header), while keeping existing analytics, support linking, wallet deletion, and error-report/copy flows intact. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ececdf9. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 0a62384 commit 543e138

4 files changed

Lines changed: 74 additions & 200 deletions

File tree

app/components/Views/WalletCreationError/SRPErrorScreen.styles.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

app/components/Views/WalletCreationError/SRPErrorScreen.tsx

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
import React, { useCallback, useState, useRef, useEffect } from 'react';
2-
import { View, SafeAreaView, ScrollView, Linking } from 'react-native';
2+
import { SafeAreaView, ScrollView, Linking } from 'react-native';
33
import { useNavigation } from '@react-navigation/native';
44
import Clipboard from '@react-native-clipboard/clipboard';
55
import { captureException } from '@sentry/react-native';
66
import { connect } from 'react-redux';
77
import { Dispatch } from 'redux';
88

9+
import { useTailwind } from '@metamask/design-system-twrnc-preset';
10+
import {
11+
Box,
12+
Text,
13+
TextVariant,
14+
TextColor,
15+
FontWeight,
16+
Icon,
17+
IconName,
18+
IconSize,
19+
IconColor,
20+
} from '@metamask/design-system-react-native';
21+
922
import {
1023
OnboardingActionTypes,
1124
saveOnboardingEvent as saveEvent,
@@ -14,27 +27,17 @@ import { MetaMetricsEvents } from '../../../core/Analytics';
1427
import trackOnboarding from '../../../util/metrics/TrackOnboarding/trackOnboarding';
1528
import { ITrackingEvent } from '../../../core/Analytics/MetaMetrics.types';
1629
import { MetricsEventBuilder } from '../../../core/Analytics/MetricsEventBuilder';
17-
import Text, {
18-
TextVariant,
19-
TextColor,
20-
} from '../../../component-library/components/Texts/Text';
2130
import Button, {
2231
ButtonVariants,
2332
ButtonSize,
2433
ButtonWidthTypes,
2534
} from '../../../component-library/components/Buttons/Button';
26-
import Icon, {
27-
IconName,
28-
IconSize,
29-
IconColor,
30-
} from '../../../component-library/components/Icons/Icon';
35+
import { IconName as CLibIconName } from '../../../component-library/components/Icons/Icon';
3136

3237
import { strings } from '../../../../locales/i18n';
3338
import Routes from '../../../constants/navigation/Routes';
34-
import { useStyles } from '../../../component-library/hooks/useStyles';
3539
import AppConstants from '../../../core/AppConstants';
3640
import { Authentication } from '../../../core';
37-
import styleSheet from './SRPErrorScreen.styles';
3841

3942
interface SRPErrorScreenProps {
4043
error: Error;
@@ -46,11 +49,10 @@ const SRPErrorScreen = ({
4649
saveOnboardingEvent,
4750
}: SRPErrorScreenProps) => {
4851
const navigation = useNavigation();
49-
const { styles } = useStyles(styleSheet, {});
52+
const tw = useTailwind();
5053
const [copied, setCopied] = useState(false);
5154
const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
5255

53-
// Cleanup timeout on unmount
5456
useEffect(
5557
() => () => {
5658
if (copyTimeoutRef.current) {
@@ -60,7 +62,6 @@ const SRPErrorScreen = ({
6062
[],
6163
);
6264

63-
// Track screen viewed event
6465
useEffect(() => {
6566
trackOnboarding(
6667
MetricsEventBuilder.createEventBuilder(
@@ -90,7 +91,6 @@ const SRPErrorScreen = ({
9091
saveOnboardingEvent,
9192
);
9293

93-
// Delete wallet
9494
await Authentication.deleteWallet();
9595
navigation.reset({
9696
routes: [{ name: Routes.ONBOARDING.ROOT_NAV }],
@@ -146,50 +146,50 @@ const SRPErrorScreen = ({
146146
}, []);
147147

148148
return (
149-
<SafeAreaView style={styles.container}>
149+
<SafeAreaView style={tw.style('flex-1 bg-default')}>
150150
<ScrollView
151-
contentContainerStyle={styles.scrollContent}
151+
contentContainerStyle={tw.style('flex-grow p-4')}
152152
showsVerticalScrollIndicator={false}
153153
>
154-
<View style={styles.content}>
154+
<Box twClassName="flex-1 items-center pt-12">
155155
<Icon
156156
name={IconName.Danger}
157157
size={IconSize.Xl}
158-
color={IconColor.Error}
159-
style={styles.warningIcon}
158+
color={IconColor.ErrorDefault}
159+
twClassName="mb-4"
160160
/>
161161

162-
<Text variant={TextVariant.HeadingMD} style={styles.title}>
162+
<Text variant={TextVariant.HeadingMd} twClassName="text-center mb-4">
163163
{strings('wallet_creation_error.title')}
164164
</Text>
165165

166-
<View style={styles.infoBanner}>
166+
<Box twClassName="flex-row bg-info-muted rounded-lg p-3 mb-6 w-full">
167167
<Icon
168168
name={IconName.Info}
169169
size={IconSize.Sm}
170-
color={IconColor.Info}
171-
style={styles.infoBannerIcon}
170+
color={IconColor.InfoDefault}
171+
twClassName="mr-2 mt-0.5"
172172
/>
173173
<Text
174-
variant={TextVariant.BodySM}
175-
color={TextColor.Alternative}
176-
style={styles.infoBannerText}
174+
variant={TextVariant.BodySm}
175+
color={TextColor.TextAlternative}
176+
twClassName="flex-1"
177177
>
178178
{strings('wallet_creation_error.srp_description_part1')}{' '}
179179
<Text
180-
variant={TextVariant.BodySM}
181-
color={TextColor.Primary}
180+
variant={TextVariant.BodySm}
181+
color={TextColor.PrimaryDefault}
182182
onPress={handleContactSupport}
183183
>
184184
{strings('wallet_creation_error.metamask_support')}
185185
</Text>
186186
{'.'}
187187
</Text>
188-
</View>
188+
</Box>
189189

190-
<View style={styles.errorReportContainer}>
191-
<View style={styles.errorReportHeader}>
192-
<Text variant={TextVariant.BodyMDMedium}>
190+
<Box twClassName="w-full mb-6">
191+
<Box twClassName="flex-row justify-between items-center mb-2">
192+
<Text variant={TextVariant.BodyMd} fontWeight={FontWeight.Medium}>
193193
{strings('wallet_creation_error.error_report')}
194194
</Text>
195195
<Button
@@ -201,29 +201,29 @@ const SRPErrorScreen = ({
201201
: strings('wallet_creation_error.copy')
202202
}
203203
onPress={handleCopyError}
204-
startIconName={copied ? IconName.Check : IconName.Copy}
204+
startIconName={copied ? CLibIconName.Check : CLibIconName.Copy}
205205
/>
206-
</View>
206+
</Box>
207207
<ScrollView
208-
style={styles.errorReportContent}
208+
style={tw.style('bg-alternative rounded-lg p-3 max-h-[200px]')}
209209
nestedScrollEnabled
210210
showsVerticalScrollIndicator
211211
>
212-
<Text variant={TextVariant.BodySM} color={TextColor.Error}>
212+
<Text variant={TextVariant.BodySm} color={TextColor.ErrorDefault}>
213213
{errorReport}
214214
</Text>
215215
</ScrollView>
216-
</View>
217-
</View>
216+
</Box>
217+
</Box>
218218

219-
<View style={styles.buttonContainer}>
219+
<Box twClassName="w-full pt-4 pb-6">
220220
<Button
221221
variant={ButtonVariants.Primary}
222222
size={ButtonSize.Lg}
223223
width={ButtonWidthTypes.Full}
224224
label={strings('wallet_creation_error.send_error_report')}
225225
onPress={handleSendErrorReport}
226-
style={styles.button}
226+
style={tw.style('mb-4')}
227227
/>
228228

229229
<Button
@@ -233,7 +233,7 @@ const SRPErrorScreen = ({
233233
label={strings('wallet_creation_error.try_again')}
234234
onPress={handleTryAgain}
235235
/>
236-
</View>
236+
</Box>
237237
</ScrollView>
238238
</SafeAreaView>
239239
);

app/components/Views/WalletCreationError/SocialLoginErrorSheet.styles.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)