Closed vikrvm closed 2 years ago
That's normal, since at start the JS has to be loaded, parsed and executed first. If you want to support dark mode, you can duplicate your xml files and add a night suffix to the directory (ex: values-night, values-night-v27). More infos: https://developer.android.com/develop/ui/views/theming/darktheme
@zoontek hey since i want to support both light and dark theme at the startup. I found a solution can you check it out. Its working without JS code. Do you think its a good idea doing like this.
Code
@Override
protected void onCreate(Bundle savedInstanceState) {
RNBootSplash.init(this);
super.onCreate(null);
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) {
RNBars.init(this, "light-content");
} else {
RNBars.init(this, "dark-content");
}
}
@batuhansahan It works yeah. Don't forget to also create a dedicated values-night-xxx.xml
file too.
Bug summary
So after going through the setup docs and getting things working, everything works just fine. The only thing I noticed is the initial load does not respect what color is set for the user's device. For example my current code:
https://user-images.githubusercontent.com/6226652/191576643-436aad71-ee4f-46d8-8a6a-f1912ae5fde3.mov
Is there a fix to allow the
<SystemBars />
initial styles to be relevant to theuseColorScheme
hook?Library version
1.2.2
Environment info
Steps to reproduce
Steps show in the sample code.
Reproducible sample code
MainActivity.java
values/styles.xml
values-v27/styles.xml