天天看点

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

每个项目产品都要加埋点,加500行埋点是不是会占用你一两天的时间而且很容易犯错,想只用一小时准确加完这500行埋点剩下一天喝茶聊天么?来试试这520web工具, 高效加埋点,目前我们公司100号前端都在用,因为很好用,所以很自然普及开来了,推荐给大家吧

http://www.520webtool.com/

自己开发所以免费,埋点越多越能节约时间,点两下埋点就加上了,还不会犯错,里面有使用视频,反正免费 😄

报错:undefined is not an object (evaluating 'RNGestureHandlerModule.State')

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

我的项目原因:   react-native link react-native-gesture-handler  这个命令行没有运行成功,

运行成功之后,打开xcode 运行,又报错  

React/RCTEventDispatcher.h not found in 

解决方案参考链接:https://github.com/kmagiera/react-native-gesture-handler/issues/179#issuecomment-450346252 

链接中的方法就是,手动去添加 RNGesturehandlermodule, 我照着步骤执行成功了(我有空就把下面的方法翻译一下)

1/ open your ios Podfile and delete all yout linked dependencies: pod 'xxxxxxx', :path => '../node_modules/xxxxx'

2/ Close Xcode

3/ In your /ios folder run "pod update"

4/ In your project source run "react-native link"

5/ Open Xcode and Clean Build Folder from Xcode Menu -> Product

6/ Run your application from Xcode

7/ Link manually the dependency "react-native-gesture-handler" into your Xcode Project following steps in documentation: https://facebook.github.io/react-native/docs/linking-libraries-ios

8/ Now run your application from Xcode, you should be fine.

2019.03.14 补充手动link方法

iOS: 

1.xcode 打开项目, 左侧栏,右击Libraries --> Add files to "***工程名**"---->node_modules--->react-navigation-gesturehandler---->......---->RNGestureHandler.xcodeproj  选中添加;

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

图1

2. 添加依赖库 libRNGestureHandler.a, 步骤如下示意图(在General栏下):

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

图2

Android:

1.android ----> settings.gradle 文件中添加(图3):

include ':react-native-gesture-handler'

project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

图3

2.android ---> app---->build.gradle文件中添加(图4)

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

图4

3..android ---> app---->src--->main--->java--->com--->.....---->MainApplication.java文件中添加(图5):

undefied is ... (...RNGestureHandlerModule.State)..React/RCTEventDispatcher.h not found in 2019.03.14 补充手动link方法

图5

备注:有的项目中,我也添加了这个:import com.facebook.react.ReactActivityDelegate;这边就不截图了

作者:太阳的小号

链接:https://www.jianshu.com/p/d5bdf455db47

来源:简书

简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。