我是新反应母语。我在我的整合现有的Android原生应用与反应原生应用。正在运行的应用程序是示出此错误后反应天然部分:
null不是(评价“C.State”)未知index.android.bundle对象
以下是错误的截图:Screenshot of error message
我知道,这样的错误消息来自我每次使用反应导航和应对本地手势处理程序的时间。
下面是的package.json文件中的代码:
{
"name": "Demo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "^0.58.3",
"react-native-gesture-handler": "^1.0.15",
"react-navigation": "^3.1.4"
},
"devDependencies": {
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "24.0.0",
"jest": "24.0.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
下面是呈现反应,本机模块的本地活动:
public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
private ReactRootView mReactRootView;
private ReactInstanceManager mReactInstanceManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index.android")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
Bundle initialProps = new Bundle();
String str = MainActivity.getMovieID();
initialProps.putString("movie_id", str);
mReactRootView.startReactApplication(mReactInstanceManager, "AwesomeProject", initialProps);
setContentView(mReactRootView);
}
观察写在上面的代码index.android.bundle。
同时运行的应用程序之前,我运行此命令来解决Unable to load script from assets index.android.bundle
反应天然束--platform机器人--dev假--entry文件index.js --bundle输出机器人/应用/ SRC /主/资产/ index.android.bundle --assets-DEST机器人/应用/ SRC /主/ RES
这里也观察到的东西是在index.android.bundle正在做
无法找到与此相关的任何错误。任何帮助将不胜感激。谢谢。
我有一个类似的问题,我做了什么来解决它,这是阅读阵营导航文件,在这个页面是我的解决方案:
https://reactnavigation.org/docs/en/getting-started.html
在此之后,如果你在你的settings.gradle文件中的错误,说是这样的:
故障:建立失败,一个例外。
- 哪里:
设置文件 'C:\ PATH \ TO \你\ PROJECT \机器人\ settings.gradle' 行:3 ...
在你settings.gradle文件,更改这些字符“\”这一个“/”在你看到这行:“.. \ node_modules \反应母语手势处理程序\ Android的
就是这样,希望我能够帮助...