im使用react-native和react-native-navigation,但是当我运行项目时,发生此错误“请求的原型值不是对象”。
我不使用redux
App.js:
import {Navigation} from 'react-native-navigation';
import {HomeComponent} from './src/home';
Navigation.registerComponent("navigation.playground.HomeComponent", () => HomeComponent);
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: 'navigation.playground.HomeComponent'
}
}
});
});
index.js:
import {Navigation} from "react-native-navigation";
import {App} from './App';
Navigation.registerComponent(`navigation.playground.HomeComponent`, () => App);
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: "navigation.playground.HomeComponent"
}
}
});
});
home.js:
import React, {Component} from 'react';
import { Text, View} from 'react-native';
class HomeComponent extends Component{
render() {
return (
<View>
<Text>This is Home</Text>
</View>
);
}
}
export default HomeComponent;
然后结束
结果:
答案 0 :(得分:1)
发生gradle时,此问题与本机版本不兼容。 https://wix.github.io/react-native-navigation/#/docs/Installing
7和8部分非常重要,解决的方法就是问题
如果您仔细阅读文档,则不会发生!
尽管实现这一部分的“本机导航”确实很复杂!
最后使用gradle 4.4而不是4.6进行react-native57