Cannot read property 'Direction' of undefined

最近在学习React Native,在运行网上的一个项目时,出现了一个问题,在模拟器上面出现了以下错误,纠结了好久,最终解决了问题,记录一下:

Cannot read property 'Direction' of undefined

解决方法如下:
1 、react-navigation在React Native项目中安装包。

yarn add react-navigation
# or with npm
# npm install --save react-navigation

接下来,安装react-native-gesture-handler。如果您正在使用Expo管理的工作流程,那么您不需要在此处执行任何操作,它包含在SDK中。除此以外:

yarn add react-native-gesture-handler@~1.0.14
# or with npm
# npm install --save react-native-gesture-handler@~1.0.14

链接所有本机依赖项:

react-native link react-native-gesture-handler

此时再去运行项目,即可运行成功,以下是我项目的package文件

Cannot read property 'Direction' of undefined_第1张图片
这个是我项目的package文件

reactnavigation官方网址如下:

https://reactnavigation.org/docs/en/getting-started.html

你可能感兴趣的:(Cannot read property 'Direction' of undefined)