Skip to content

Conversation

@georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Nov 6, 2025

Description

Fixed Toast component theme not updating when switching between light and dark mode in production builds (TestFlight). The issue only affected production builds while working correctly in development/simulator.

Root Cause:

The Toast component had an empty dependency array [] in its useMemo hook (line 69), which cached the initial theme styles and never updated when the theme changed. This was a remnant from when Toast used inverse/hardcoded theming.

Solution:

Updated the useMemo dependency array to properly track [styles.base, animatedStyle], ensuring the component re-renders with correct theme colors when theme changes occur.

Changelog

CHANGELOG entry: Fixed Toast component not updating theme colors when switching between light and dark mode

Related issues

Fixes: Theme change issue in Toast component

Manual testing steps

Feature: Toast theme updates correctly

  Scenario: User switches device theme while Toast is visible
    Given the app is running with a visible Toast notification
    
    When user switches from light mode to dark mode (or vice versa) in device settings
    Then the Toast should update to match the new theme colors immediately
    
  Scenario: Toast appears with correct theme in production build
    Given the app is running in a TestFlight production build
    And user has dark mode enabled
    
    When a Toast notification appears
    Then the Toast displays with correct dark theme colors (not stuck in light theme)

Screenshots/Recordings

Before

Toast remained in previous theme colors when device theme was changed in production builds.

before.MP4

After

Toast correctly updates to match current theme in both development and production builds.

after.MP4

Pre-merge author checklist

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.

Note

Update Toast baseStyle useMemo to depend on styles.base and animatedStyle (and simplify its type) so styling updates correctly.

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

@georgewrmarshall georgewrmarshall requested a review from a team as a code owner November 6, 2025 23:35
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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.

@metamaskbot metamaskbot added the team-design-system All issues relating to design system in Mobile label Nov 6, 2025
@georgewrmarshall georgewrmarshall self-assigned this Nov 6, 2025
@georgewrmarshall georgewrmarshall added the No QA Needed Apply this label when your PR does not need any QA effort. label Nov 6, 2025
@georgewrmarshall georgewrmarshall changed the title fix: Toast component theme reactivity in production builds fix: Toast component theme reactivity in production builds cp-7.59.0 Nov 7, 2025
Comment on lines -65 to +68
const baseStyle: StyleProp<Animated.AnimateStyle<StyleProp<ViewStyle>>> =
useMemo(
() => [styles.base, animatedStyle],
/* eslint-disable-next-line */
[],
);
const baseStyle: StyleProp<ViewStyle> = useMemo(
() => [styles.base, animatedStyle],
[styles.base, animatedStyle],
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The empty dependency array [] cached the initial theme styles and never updated when the theme changed. This was a remnant from when Toast used inverse/hardcoded theming.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit a659739 Nov 7, 2025
85 checks passed
@georgewrmarshall georgewrmarshall deleted the fix-toast-theming branch November 7, 2025 17:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2025
@metamaskbot metamaskbot added the release-7.60.0 Issue or pull request that will be included in release 7.60.0 label Nov 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.60.0 Issue or pull request that will be included in release 7.60.0 size-XS team-design-system All issues relating to design system in Mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants