Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Pro 1.1.0 / iOS] bg-* views stuck on previous theme after OS appearance flip + react-navigation native-stack push/pop #518

Open
Labels

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-screens freeze 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

  1. Check out the react-navigation-bug-repro branch of the linked repo, then pnpm install && pnpm expo prebuild && pnpm ios.
  2. Open the List tab (Animated.FlatList with a sliding header overlay backed by bg-surface).
  3. Toggle the iOS Simulator's appearance once via Control Center (Cmd+Shift+A — not Settings → Display).
  4. Tap any card to push into Detail, then tap Back.
  5. The cards on the returned List screen still render the previous theme's bg-surface color. Scrolling the FlatList or tapping a card forces a re-render and the colors snap to the correct theme.
  6. Switch to the expo-router-fix-reference branch (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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /