【发布时间】:2019-05-23 09:55:36
【问题描述】:
我正在尝试使用最新的 react-navigation 版本运行我的应用程序,但无法正常工作。也尝试使用此解决方案 (Invariant Violation: The navigation prop is missing for this navigator) 但没有解决方案。
错误信息
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
我的代码
App.js
import App from './app/index';
export default App;
index.js
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { SignedOut } from "./router";
export default class App extends React.Component {
render() {
return <SignedOut />;
}
}
路由器.js
import { createStackNavigator, createAppContainer } from "react-navigation";
import SignUp from "./screens/SignUp";
import SignIn from "./screens/SignIn";
export const SignedOut = createStackNavigator({
SignUp: {
screen: SignUp,
navigationOptions: {
title: "Sign Up"
}
},
SignIn: {
screen: SignIn,
navigationOptions: {
title: "Sign In"
}
}
});
【问题讨论】:
标签: javascript reactjs react-native