[英]Invariant Violation: The navigation prop is missing for this navigator. in react-navigation 4
I am trying to create a navigation drawer for my React native App, using 2 screens,home screen and connection sreen but i keep getting this error:我正在尝试为我的 React 本机应用程序创建一个导航抽屉,使用 2 个屏幕、主屏幕和连接屏幕,但我不断收到此错误:
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
what's wrong with my code please.请问我的代码有什么问题。 my App.js:
我的 App.js:
import React from 'react';
import Search from './Components/Search'
import { createDrawerNavigator } from 'react-navigation-drawer'
import { createStackNavigator,createAppContainer } from 'react-navigation'
//import Connection from './Screens/ConnectionScreen';
import AccueilScreen from './Screens/AccueilScreen';
export default class App extends React.Component {
render(){
return (
<AppDrawerNavigator/>
);
}
}
const AppDrawerNavigator = createDrawerNavigator({
//Se_Connecter: Connection,
Accueil:{
screen : AccueilScreen,
},
});
const AppNavigator= createAppContainer(AppDrawerNavigator);
You are rendering the DrawerNavigator
without using the AppContainer (that you created)您在不使用 AppContainer(您创建的)的情况下渲染
DrawerNavigator
export default class App extends React.Component {
render(){
return (
<AppNavigator/>
);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.