Closed pablogdcr closed 1 year ago
@pablogdcr Hi π Could you publish your values-night/styles.xml
?
Hi @zoontek! I didn't have the values-night
folder at the beginning.
While doing some tests to understand why the splash screen wasn't working, I created it with the same values as in the values
folder. So both of my styles.xml
looks like this:
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/green</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
<!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/bootsplash_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
And then my colors.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bootsplash_background">#07BAA4</color>
</resources>
@pablogdcr So it's normal and not an issue with this library. If you supports dark theme but don't create -night
res directory variants (or use theme attributes, like base android colors), it will simply does not work.
More infos: https://developer.android.com/develop/ui/views/theming/darktheme#themes-styles
In my project, the dark theme is not supported.
In the empty app that I created to reproduce this bug, it is supported and the values-night
folder contains the files colors.xml
, strings.xml
, and styles.xml
.
With styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
<!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/bootsplash_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
And colors.xml:
<resources>
<color name="bootsplash_background">#07BAA4</color>
</resources>
Did I miss something?
@pablogdcr Does this happen on a physical device? I know MIUI (Xiaomi phones) and Huawei are terrible at handling dark mode.
On a physical device, and yes they are terrible! I'm testing on an MIUI: Redmi Note 9S. I just tested it on a Samsung S20 Ultra 5G and it's working fine, so I suppose that the issue is more related to MIUI then...
@pablogdcr Yes, it's probably MIUI related. I already worked with Google to deploy a fix specific to MIUI in AndroidX core-splashscreen 1.0.0-beta2. I think the best option here is to declare the issue on Android issue tracker directly.
I wish people stop buying these trash phones π
Ok thanks, I will.
I'd like that too! π΅βπ«
Any update on this issue? I'm using version 1.0.0 of the splash screen library and still getting this issue.
@danidaryaweesh Check Google issue tracker. It's an AndroidX core issue (but mostly a MIUI issueβ¦if they have a bug tracker, they should fix this)
I'm closing this since it's an issue with MIUI. Nothing can be done at this library level.
Added to the styles.xml
<item name="android:windowIsTranslucent">true</item>
now it is ok in dark mode
Bug summary
The background color of the splash screen stays in black on Android with night mode activated.
Result in day mode:
Result in night mode:
Library version
4.3.2
Environment info
Steps to reproduce
npx react-native init Test --version 0.69.5
Reproducible sample code
I tested with a minimal app, with only this package install, and by following the steps on the installation guide, and the command to generate the splash screen. The only code I have is:
styles.xml:
AndroidManifest.xml:
MainActivity.java: