Set status bar style with theme

Instead of making it full screen then changing on js start, we can use the same theme as in app

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-06-05 14:44:53 +03:00
parent 723975d2c9
commit fd8558421d
No known key found for this signature in database
GPG Key ID: C9A094959935A952
2 changed files with 5 additions and 1 deletions

View File

@ -127,7 +127,7 @@ public class MainActivity extends ReactFragmentActivity
Log.v("RNBootstrap", "Available system memory "+getAvailableMemory(activityManager).availMem + ", maximum usable application memory " + activityManager.getLargeMemoryClass()+"M"); Log.v("RNBootstrap", "Available system memory "+getAvailableMemory(activityManager).availMem + ", maximum usable application memory " + activityManager.getLargeMemoryClass()+"M");
setSecureFlag(); setSecureFlag();
SplashScreen.show(this, true); SplashScreen.show(this, R.style.AppTheme);
// NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17 // NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17
super.onCreate(null); super.onCreate(null);

View File

@ -6,15 +6,19 @@
<item name="android:windowBackground">?attr/backgroundColor</item> <item name="android:windowBackground">?attr/backgroundColor</item>
<item name="android:textColor">?attr/textColor</item> <item name="android:textColor">?attr/textColor</item>
<item name="android:forceDarkAllowed">true</item> <item name="android:forceDarkAllowed">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style> </style>
<style name="LightTheme" parent="AppTheme"> <style name="LightTheme" parent="AppTheme">
<item name="textColor">#000000</item> <item name="textColor">#000000</item>
<item name="backgroundColor">#ffffff</item> <item name="backgroundColor">#ffffff</item>
<item name="android:windowLightStatusBar">true</item>
</style> </style>
<style name="DarkTheme" parent="AppTheme"> <style name="DarkTheme" parent="AppTheme">
<item name="textColor">#ffffff</item> <item name="textColor">#ffffff</item>
<item name="backgroundColor">#000000</item> <item name="backgroundColor">#000000</item>
<item name="android:windowLightStatusBar">false</item>
</style> </style>
</resources> </resources>