-
Notifications
You must be signed in to change notification settings - Fork 41
[Pro 1.1.0 / iOS] bg-* views stuck on previous theme after OS appearance flip + react-navigation native-stack push/pop #518
Description
What happened?
On iOS, after toggling the OS appearance (Control Center light ↔ dark), some views with theme-driven Uniwind classes (most visibly bg-surface / bg-background) stay rendered with the previous theme's color until they receive any interaction (touch, scroll, layout change).
As far as I can tell from visual inspection, backgroundColor is the property that fails most consistently — text and border colors on the same view appear to update correctly in the cases I checked, but I have not exhaustively audited every property, so I can't rule out that others are affected too.
A single appearance flip is enough; rapidly flipping while navigating amplifies the rate but isn't required.
Swapping the navigation library to expo-router (with byte-identical screen content, same Uniwind classes, same Reanimated animations, same providers) eliminates the bug. The two branches in the linked repo are the comparison — react-navigation native-stack reproduces, expo-router does not.
Diagnostic via UniwindDiagnostics.onShadowTreeUpdate confirms Uniwind itself pushes the new theme values correctly (currentTheme, colorScheme, all nodes traversed). The miss appears to be on the iOS commit side — the new value reaches the shadow tree but isn't committed to the affected CALayer until a secondary trigger.
Already ruled out:
react-native-screensfreeze path (enableFreeze(false) + freezeOnBlur:false on both navigators) — still reproduces.- StyleSheet vs className on the affected screens — no effect.
Here a short screen recording of the List → Detail → back flow with the appearance flip in step 2 — the stale bg-surface cards on the returned List screen are the clearest visual proof.
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2026年04月27日.at.14.04.36.mov
Steps to Reproduce
- Check out the
react-navigation-bug-reprobranch of the linked repo, thenpnpm install && pnpm expo prebuild && pnpm ios. - Open the List tab (Animated.FlatList with a sliding header overlay backed by
bg-surface). - Toggle the iOS Simulator's appearance once via Control Center (Cmd+Shift+A — not Settings → Display).
- Tap any card to push into Detail, then tap Back.
- The cards on the returned List screen still render the previous theme's
bg-surfacecolor. Scrolling the FlatList or tapping a card forces a re-render and the colors snap to the correct theme. - Switch to the
expo-router-fix-referencebranch (same screens, only navigation layer differs) and repeat — bug does not reproduce.
Snack or Repository Link (Optional)
https://github.com/tobiasharth/uniwind-theme-flip-repro
Uniwind version
1.1.0
React Native Version
0.83.6
Platforms
iOS
Expo
Yes
Additional information
- I've searched for similar issues in this repository and found none
- I am a Uniwind Pro user