Skip to content

Android restart/recreate when switching explicit theme with Uniwind.setTheme (RN 0.83) #556

Description

@BenceMaraczi

What happened?

Actual Behavior

The app appears to restart / activity is recreated on theme switch.

Expected Behavior

Theme switches should happen without app/activity restart.

Suspected Root Cause

In setTheme, Uniwind forces native appearance sync via Appearance.setColorScheme(...) for explicit themes.
On Android + newer RN, this seems to trigger configuration changes/activity recreation in some setups.

Workaround (validated)

Skipping Appearance.setColorScheme(...) on Android while keeping Uniwind internal theme updates and listener notifications resolves the restart behavior for us.

Steps to Reproduce

  1. Run an app on Android with Uniwind configured.
  2. Add a runtime theme switcher that calls:
    • Uniwind.setTheme('light')
    • Uniwind.setTheme('dark')
  3. Toggle between light and dark multiple times.

Snack or Repository Link

.

Uniwind version

1.5.0

React Native Version

0.83.0

Platforms

Android

Expo

No

Additional information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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