【发布时间】:2019-04-21 08:58:22
【问题描述】:
当我尝试启动我的 react 本机应用程序时收到此消息。通常这种格式适用于其他多屏导航,但在这种情况下不知何故不起作用。
这是错误:
Invariant Violation: The navigation prop is missing for this navigator. In
react-navigation 3 you must set up your app container directly. More info:
https://reactnavigation.org/docs/en/app-containers.html
这是我的应用程序格式:
import React, {Component} from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { createStackNavigator } from 'react-navigation';
import Login from './view/login.js'
import SignUp from './view/signup.js'
const RootStack = createStackNavigator(
{
Home: {
screen: Login
},
Signup: {
screen: SignUp
}
},
{
initialRouteName: 'Home'
}
);
export default class App extends React.Component {
render() {
return <RootStack />;
}
}
【问题讨论】:
-
它说你缺少应用容器
-
所以基本上我必须将 Stack Navigator 中的所有内容都放在 App Container 中?我感到困惑的是,这种设置在我以前的项目中没有任何错误。
标签: reactjs react-native