【发布时间】:2022-11-07 17:15:21
【问题描述】:
我在使用 react-native-splash-screen 时遇到问题
反应原生信息
- 节点:16.17.0
- 纱线:1.22.19
- 反应:18.1.0
- 反应原生:0.70.0
错误
MainActivityDelegate cannot be converted to Activity SplashScreen.show(this);
MainActivity.java
`
package com.ala.com.ala;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.lockincomp.liappagent.LiappAgent;
import org.devio.rn.splashscreen.SplashScreen;
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
...my other codes
super.onCreate(null);
// super.onCreate(savedInstanceState); <- this also tried but not working
}
`
我不知道为什么我会出现这种错误。因为 React Native 0.7 版本错误?或者什么...请帮助..
我也尝试使用 react-native-bootsplash 但是这个库也有错误
`@覆盖
protected void onCreate(Bundle savedInstanceState) {
RNBootSplash.init(this); //这部分有错误
super.onCreate(savedInstanceState); // 或带有 react-native-screens 的 super.onCreate(null)
}`
【问题讨论】:
标签: react-native react-native-splash-screen