0
votes

I have two themes set up in styles.xml. When the app launches I want to set the appropriate theme based on the dark mode choice of the device. Let's say I want to have different colors for windowBackground in dark / light modes.

(Initial window background color is set before React loads, so should be done in Android side.)

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">#ff0000</item>
    </style>

    <style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowBackground">#00ff00</item>
    </style>

</resources>
1

1 Answers

1
votes

Just creating a values-night folder at android/app/src/main/res/ and placing another styles.xml with the dark theme in it solved my issue.

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowBackground">#00ff00</item>
    </style>

</resources>