我收到一个错误,提示我的createDrawerNavigator无法运行

时间:2019-12-09 19:40:33

标签: reactjs react-native

当我尝试导入createDrawerNavigator时出现以下错误 预期的输出是启动页面在“登录”屏幕上打开。 appNavigator代码如下。

  if (!isLoadingComplete && !props.skipLoadingScreen) {
    return (
      <AppLoading
        startAsync={loadResourcesAsync}
        onError={handleLoadingError}
        onFinish={() => handleFinishLoading(setLoadingComplete)}
      />
    );
  } else {
    return (
      <View style={styles.container}>
        {Platform.OS === 'ios' && <StatusBar barStyle="default" />}
        <AppNavigator />
      </View>
    );
  }

错误如下:

(0, _reactNavigation.DrawerNavigator) is not a function. (In '(0, _reactNavigation.DrawerNavigator)({
    Splash: _splash.default
  }, RouteConfig)', '(0, _reactNavigation.DrawerNavigator)' is undefined)

1 个答案:

答案 0 :(得分:1)

对于v4的{​​{1}},您必须安装react-navigation的软件包

  

添加纱线react-navigation-drawer

并使用它:

drawerNavigation

完整文档为here.