react-native之 ‘RNGestureHandlerModule.State’ ----------小白的天堂

null is not an objuect(evaluating ‘RNGesturehandlerModule.State’)

这个错误主要是引用了新版react-navigation造成的,(react-navigation:’3+’)

解决方法:

Android:

执行:yarn add react-native-gesture-handler

react-native link

Ios:

先link,有时候会link以后还是后报错,这时候需要我们手动配置:

  1. Xcode打开项目,在Libraries上右键选择“Add FIles to ‘your project’”

 

2. 选择本项目下node_modules 下 react-native-gesture-handler中ios文件夹,点击’RNGestureHandler.xcodeproj‘,点击添加按钮

 

3. 这时候在Libraries中就i出现了“RNGestureHandler.xcodeproj”

 

4. 点开这个文件,选择Products,把里面的libRNGestureHandler.a文件拖入项目中Build Phases中 link Binary With Libraries中:

 

至此,手动配置结束,然后build项目,运行就可以了。

发布了10 篇原创文章 · 获赞 10 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_41457238/article/details/87794605