Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android undefined不是计算0的函数,reactnavigation.createDrawerNavigator_Android_React Native_React Native Android_Navigation Drawer - Fatal编程技术网

Android undefined不是计算0的函数,reactnavigation.createDrawerNavigator

Android undefined不是计算0的函数,reactnavigation.createDrawerNavigator,android,react-native,react-native-android,navigation-drawer,Android,React Native,React Native Android,Navigation Drawer,我有下面的代码 import { createStackNavigator,createAppContainer,DrawerNavigator,createDrawerNavigator, DrawerActions } from 'react-navigation'; const RootStack = createDrawerNavigator( { Home: HomeScreen, Details: DetailsScreen,

我有下面的代码

import { createStackNavigator,createAppContainer,DrawerNavigator,createDrawerNavigator, DrawerActions } from 'react-navigation';
    const RootStack = createDrawerNavigator(
      {
        Home: HomeScreen,
        Details: DetailsScreen,
      },
      {
        intialRouteName: 'Home',
        navigationOptions: {
          headerStyle : {
            backgroundColor: '#f4511e',
          },
          headerTintColor: '#fff',
          headerTitleStyle : {
            color: 'white',
          },
        },
      }
    );


    export default class App extends React.Component {
      render() {
        return <RootStack/>;
      }
    }
从“react navigation”导入{createStackNavigator、createAppContainer、DroperNavigator、CreateDroperNavigator、DroperActions};
const RootStack=createDrawerNavigator(
{
主页:主屏幕,
详情:详情屏幕,
},
{
初始路由名称:“主页”,
导航选项:{
头型:{
背景颜色:“#F451E”,
},
标题颜色:“#fff”,
头饰样式:{
颜色:'白色',
},
},
}
);
导出默认类App扩展React.Component{
render(){
返回;
}
}
它总是显示错误

未定义不是一个函数 0,reactnavigation.createDrawerNavigator

我尝试了通过网络找到的不同解决方案,但总是出现相同的错误,看起来像是“react navigation”的版本问题

“反应导航”:“1.0.0-beta.23”

我在react native的第一天就没能拿到它

需要帮忙吗,谢谢


谢谢

我将抽屉导航设置为:

制作一个route.js文件并将所有这些代码添加到其中

注意:添加组件名称而不是组件名称

然后在app.js文件上导入

MyDrawerNavigator

像这样

import MyDrawerNavigator from 'path/to/routes.js'
然后在app.js上像这样使用它

export default class App extends Component{
  render() {
    return (
        <MyDrawerNavigator />
    );
  }
}
导出默认类应用程序扩展组件{
render(){
返回(
);
}
}
就这样:)

我使用react导航版本-->2.5.5


希望它能为您工作。

您能为我制作一份点心吗?我正在编写第一个程序,很难重新编写代码并使其运行。您为什么不使用
react导航
version 3?
export default class App extends Component{
  render() {
    return (
        <MyDrawerNavigator />
    );
  }
}