HwangTaehyun / react-native-lottie-splash-screen

⚡ Lottie splash screen for your react native app!
MIT License
222 stars 62 forks source link

how to change status bar black color #6

Closed muhamedzeema closed 3 years ago

muhamedzeema commented 3 years ago

Run react-native info in your project and share the content.

What react-native-splash-screen version are you using? "react-native-lottie-splash-screen": "^0.1.12", What platform does your issue occur on? (Android/iOS/Both) android Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue 2) Interesting logs

Join a screenshot or video of the problem on the simulator or device?

Screen Shot 2021-03-15 at 6 01 22 PM

Show us the code you are using?

i tried this solution LINK but the app crashes when implementing this because i think you use SplashScreen.show(this, R.id.lottie); so any help with this please ? .

girish54321 commented 3 years ago

@muhamedzeema you will have to do some changes in native android.

muhamedzeema commented 3 years ago

@muhamedzeema you will have to do some changes in native android.

any assistance please ?

girish54321 commented 3 years ago

add color.xml in ..android/app/src/main/res/values and pate following code

<?xml version="1.0" encoding="utf-8"?>

#3F51B5 #A52D53 #FF4081

copy and pate following code in ..android/app/src/main/res/values/styles.xml

Sorry for bad format or search for "react native status bar color change xml"

muhamedzeema commented 3 years ago

@girish54321 hello thanks for that, but already i had this implemented the issue is that the status bar is only Black on splash screen but the whole app have the color i set on colorPrimaryDark. my problem is that i can't change the black color from the splash screen, but the other app is fine. got me ?

girish54321 commented 3 years ago

@muhamedzeema Ya I got you now but look only @HwangTaehyun can help you with this.

muhamedzeema commented 3 years ago

@girish54321 thank you!, @HwangTaehyun any help with this please ?

HwangTaehyun commented 3 years ago

Sorry for late. I check this issue. You should use this api public static void show(final Activity activity, final int themeResId, final int lottieId) to set theme color. I paste the example code below. Thank you!

SplashScreen.show(this, R.style.SplashTheme, R.id.lottie);
Kladislav commented 3 years ago

@HwangTaehyun hi, how to configure the R.style.SplashTheme, and i got the follow error while building: MainActivity.java:23: error: cannot find symbol SplashScreen.show(this, R.style.SplashTheme, R.id.lottie); // here

HwangTaehyun commented 3 years ago

@muhamedzeema @Kladislav hi, I followed the guide in https://github.com/crazycodeboy/react-native-splash-screen

If you want to customize the color of the status bar when the splash screen is displayed: Create android/app/src/main/res/values/colors.xml and add

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="status_bar_color"><!-- Colour of your status bar here --></color>
</resources>

Create a style definition for this in android/app/src/main/res/values/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="colorPrimaryDark">@color/status_bar_color</item>
</style>
</resources>

Change your show method to include your custom style:

SplashScreen.show(this, R.style.SplashScreenTheme);

My code is below. I applied red color status bar for example. You also can apply white or transparent status bar color. Thank you!

HwangTaehyun commented 3 years ago

There's no problem with this issue anymore. I will close the issue.

ghazihussain commented 3 years ago

how to change status bar in ios?

girish54321 commented 3 years ago

Changes Safeareaview color? maybe @ghazihussain