React-native-splash-screen: White screen before splash screen

Created on 24 Feb 2019  路  5Comments  路  Source: crazycodeboy/react-native-splash-screen

I'm facing the same issue https://github.com/crazycodeboy/react-native-splash-screen/issues/338#issue-389809278 @sergiulucaci's solution makes the app to start after some delay. https://www.youtube.com/watch?v=rnLR65OGtic i try this solution i can't apply my splash design because he is using layer-list instead of layout. Any other solution?

Most helpful comment

I had the same issue. I just added android:windowIsTranslucent and android:colorBackground on styles.xml. Hope this works for you.

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:colorBackground">@color/primary_dark</item> <!--Change for the color you want -->
</style>

forgot to post where I found the solution:

https://stackoverflow.com/a/30343050

All 5 comments

I had the same issue. I just added android:windowIsTranslucent and android:colorBackground on styles.xml. Hope this works for you.

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:colorBackground">@color/primary_dark</item> <!--Change for the color you want -->
</style>

forgot to post where I found the solution:

https://stackoverflow.com/a/30343050

In file res/layout/lauch_screen.xml add android:background="#ffffff" in tag RelativeLayout

Example:
<RelativeLayout
             ...
             android:layout_height="match_parent"
             android:background="#ffffff">
</RelativeLayout>

I have created a SplashActivity

import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); } }

and in AndroidManifest.xml

<activity android:name=".SplashActivity" android:label="@string/app_name" android:theme="@style/SplashTheme" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

SplashTheme is basic
<style name="SplashTheme" parent="AppTheme"> <!-- Customize your theme here. --> <item name="android:windowIsTranslucent">true</item> </style>

@martianatwork if you use android:windowIsTranslucent and react-native-orientation-locker together it breaks react-native-orientation-locker and Android 8.0 and above.

For me what worked was this tutorial https://codingambitions.com/reactnative/how-to-add-splash-screen-in-react-native-app-for-android/

Adding true at AppTheme

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowDisablePreview">true</item>
    </style>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhaogao picture zhaogao  路  4Comments

erdemildiz picture erdemildiz  路  5Comments

js1121302139 picture js1121302139  路  5Comments

luqingxuan picture luqingxuan  路  3Comments

zxyah picture zxyah  路  4Comments