当我尝试导入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)
答案 0 :(得分:1)
对于v4
的{{1}},您必须安装react-navigation
的软件包
添加纱线react-navigation-drawer
并使用它:
drawerNavigation
完整文档为here.