获得与生成react-native-bootsplash所使用的不同的bootsplash图标

问题描述 投票:0回答:1

我们从react-native-bootsplash-v4迁移到react-native-bootsplash-v6以获得dark-splash支持。 CLI 使用提供的徽标生成所需的资产。背景颜色发生了变化,但是我们在生成资产时得到了不同的徽标,而不是参数中使用的徽标

一些可能有用的信息:

  • 将应用程序从 RN 0.65 迁移到 0.72
  • 按照文档中给出的方式更改了所有内容

此问题仅发生在 Android 上

android react-native android-splashscreen
1个回答
0
投票

以下更改解决了该问题

  • 从 mipmap-xx 文件夹中删除所有 bootsplash_logo.png
  • 将名为values和values-night的文件夹中的styles.xml中的值更改为以下
<!-- 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>
  • 还更改了
    MainActivity.java
  • 中的以下行
 -         RNBootSplash.init(this);
 -         RNBootSplash.init(this, R.style.BootTheme);

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

© www.soinside.com 2019 - 2024. All rights reserved.