Search code examples
androidreact-nativeandroid-splashscreen

Getting different bootsplash icon than the one that was used by generating react-native-bootsplash


We migrated from react-native-bootsplash-v4 to react-native-bootsplash-v6 for the dark-splash support. The CLI generated the required assets using the logo provided. The background color is changed however we are getting a different logo instead of the one used in the parameter while generating the assets

Few information that might be helpful:

  • Migrated app from RN 0.65 to 0.72
  • Changed everything as per given in the documentation

This issue is only happening on android


Solution

  • The following changes resolved the issue

    • Deleted all the bootsplash_logo.png from mipmap-xx folders
    • Changed values in styles.xml in folder named values and values-night to the following
    <!-- BootTheme should inherit from Theme.BootSplash or Theme.BootSplash.EdgeToEdge -->
        <style name="BootTheme" parent="Theme.BootSplash">
            <item name="bootSplashBackground">@color/bootsplash_background</item>
            <item name="bootSplashLogo">@drawable/bootsplash_logo</item>
            <item name="postBootSplashTheme">@style/AppTheme</item>
    <!-- The following code helps in hiding the white circle that comes up in bootsplash-->
            <item name="android:windowDisablePreview">true</item>
            <item name="android:windowIsTranslucent">true</item>
        </style>
    
    • Also changed the following line in MainActivity.java
     -         RNBootSplash.init(this);
     -         RNBootSplash.init(this, R.style.BootTheme);
    

    Source: https://github.com/zoontek/react-native-bootsplash/blob/5.5.3/MIGRATION.md