-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Toast component theme reactivity in production builds cp-7.59.0 #22291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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. |
| 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], | ||
| ); |
There was a problem hiding this comment.
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.
|



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 itsuseMemohook (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
useMemodependency 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
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
Note
Update
ToastbaseStyleuseMemoto depend onstyles.baseandanimatedStyle(and simplify its type) so styling updates correctly.Written by Cursor Bugbot for commit 1a4dca6. This will update automatically on new commits. Configure here.