Skip to content

refactor(predict): migrate Icon imports to design-system-react-native#27464

Open
Kureev wants to merge 1 commit intoMetaMask:mainfrom
margelo:kureev/DSYS-437-predict-icon-migration
Open

refactor(predict): migrate Icon imports to design-system-react-native#27464
Kureev wants to merge 1 commit intoMetaMask:mainfrom
margelo:kureev/DSYS-437-predict-icon-migration

Conversation

@Kureev
Copy link
Contributor

@Kureev Kureev commented Mar 13, 2026

Summary

  • Migrate all Predict feature files (22 files) from deprecated local Icon component (component-library/components/Icons/Icon) to @metamask/design-system-react-native
  • Resolve IconColor aliases: Default→IconDefault, Alternative→IconAlternative, Muted→IconMuted, Success→SuccessDefault
  • Resolve ReactNativeDsIconColor/ReactNativeDsIconSize aliases to canonical IconColor/IconSize

Test plan

Automated

  • yarn lint:tsc — 0 new type errors
  • yarn jest on changed test files — all pass

Manual — Icon visual verification

Verify icons render correctly (correct glyph, size, color) in these screens:

  • Predict Market List — market outcome icons (Check, Close), new button icon (Add)
  • Predict Market Details — header (ArrowLeft, Share, Export), status icons (Clock, Check, Danger), outcome icons
  • Predict Buy Preview — confirmation icons (Info, Warning, Error)
  • Predict Positions — positions header icons (Chart, ArrowDown/ArrowUp), refresh icon
  • Predict Offline — offline state icon (Danger)
  • Toast notifications — success/error/info toasts show correct icon colors:
    • Success toasts → green icon (SuccessDefault)
    • Error toasts → red icon (ErrorDefault)
    • Info toasts → blue icon (PrimaryDefault)

Note

Low Risk
Primarily a UI refactor that swaps icon components and updates icon color constants; risk is limited to potential visual regressions (wrong glyph/size/color) in Predict screens and toast/confirmation UI.

Overview
Migrates the Predict feature’s icon usage from the deprecated local component-library Icon to @metamask/design-system-react-native across multiple components, hooks, and a confirmation info view.

Updates icon color constant mappings (e.g., DefaultIconDefault, AlternativeIconAlternative, MutedIconMuted, SuccessSuccessDefault) and simplifies toast spinner props to use canonical IconColor/IconSize. Adjusts PredictMarketDetails tests to mock the design-system Icon while preserving existing testID assertions.

Written by Cursor Bugbot for commit f2fcb7b. This will update automatically on new commits. Configure here.

@Kureev Kureev requested review from a team as code owners March 13, 2026 12:18
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

const orderResult = await controllerPlaceOrder(orderParams);

// Clear any previous error state
setError(undefined);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setError cleared after order instead of before

Medium Severity

setError(undefined) was moved from before the controllerPlaceOrder call to after it succeeds. Previously, error state was cleared at the start of each order attempt, so the UI would not display a stale error during loading. Now, if a previous order failed and the user retries, the old error message remains visible throughout the loading state until the new order succeeds.

Fix in Cursor Fix in Web

label: strings('predict.deposit.try_again'),
onPress: () => deposit(params),
},
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated toast config replaces shared helper function

Low Severity

The createDepositErrorToast helper was removed and its logic was inlined identically in two places within the same deposit callback — once in the .catch() handler and once in the outer catch block. These two 19-line toast configuration objects are exact duplicates, increasing maintenance burden and risk of divergence during future edits.

Additional Locations (1)
Fix in Cursor Fix in Web

…ign-system-react-native

Migrate all Predict feature files from deprecated local Icon component
(component-library/components/Icons/Icon) to @metamask/design-system-react-native.

Changes:
- Import path swap to @metamask/design-system-react-native
- Default import converted to named import
- Icon symbols merged into existing DSRN imports
- Alias resolution: ReactNativeDsIconColor/IconSize → canonical IconColor/IconSize
- IconColor remapping: Default→IconDefault, Alternative→IconAlternative,
  Muted→IconMuted, Success→SuccessDefault
@Kureev Kureev force-pushed the kureev/DSYS-437-predict-icon-migration branch from 86c2f6f to f2fcb7b Compare March 13, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant