react-native-splash-screen--RN 0.5以上报错集合

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36091581/article/details/78807353

react-native-splash-screen的安装可以看我上一篇,或者看这个githttps://github.com/crazycodeboy/react-native-splash-screen

1.安卓按步骤安装好以后,无法启动APP或者APP出现闪退。并在输出台输出:
这里写图片描述

解决如下:
创建文件 android/app/src/main/res/values/colors.xml

<?xml version="1.0" encoding="utf-8"?> <resources> <color name="primary_dark">#660B0B0B</color> </resources>

2.启动页报错要设置canOverrideExistingModule=true
解决如下:
\node_modules\react-native-splash-screen\android\src\main\java\org\devio\rn\splashscreen\SplashScreenModule.java
SplashScreenModule.java 需要加上这个,否则报错。

@Override    
public boolean canOverrideExistingModule() { return true; }

3.启动页变成gif图
解决如下:
gif动画要在js页面进行添加,在hide方法之后。

4.启动图能做到维持原始宽高比
解决如下:
在drawable-hdpi,drawable-xhdpi,drawable-xxhdpi等目录中添加不同分辨率的启动图片即可。
参照:
hdpi:480x800、480x854
xhdpi:960*720
xxhdpi:1280×720

5.启动屏时全屏显示, 隐藏状态栏
解决如下:
把MainActivity.java的代码改成

SplashScreen.show(this, true);  // 修改这里,增加第二个参数,true是全屏false不是

依据:这里写图片描述
show有两个传递参数(activity和全屏fullScreen)

其余问题可以查看这里https://github.com/crazycodeboy/react-native-splash-screen/issues

猜你喜欢

转载自blog.csdn.net/qq_36091581/article/details/78807353