简体   繁体   English

不变违规:此导航器缺少导航道具。 在反应导航 4

[英]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.

相关问题 永久违反:此导航器缺少导航道具。 在react-navigation 3中,您必须直接设置应用容器 - Invariant Violation: The navigation prop is missing for this navigator. In react-navigation 3 you must set up your app container directly 此导航器缺少导航道具。 在 react-navigation v3 和 v4 中,您必须直接设置应用程序容器 - The navigation prop is missing for this navigator. In react-navigation v3 and v4 you must set up your app container directly 如何解决“Invariant Violation: The navigation prop is missing for this navigator”? - How to solve "Invariant Violation: The navigation prop is missing for this navigator"? 反应导航错误:此导航器缺少导航道具 - React Navigation Error: The navigation prop is missing for this navigator React native:使用 react-navigation、react-navigation-tabs 和 react-navigation-stack 时的不变违规 - React native: invariant violation when using react-navigation, react-navigation-tabs & react-navigation-stack 将HOC与react-navigation Navigator一起使用 - Using a HOC with a react-navigation Navigator 反应导航,道具验证中缺少tintColor - React-navigation, tintColor is missing in props validation 如何动态更新react-navigation标签导航器的activeTintColor? - how to update activeTintColor for react-navigation tab-navigator dynamically? 如何在底部选项卡导航器 react-navigation 中卸载非活动屏幕? - How to unmount inactive screens in bottom tab navigator react-navigation? 反应导航如何将数据向下传递给导航对象 - React-navigation how to pass data down to navigator objects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM