undefied is ... (...RNGestureHandlerModule.State)..

本文介绍了一款名为520WebTool的高效埋点工具,该工具可帮助前端工程师快速准确地完成大量埋点工作,显著提高工作效率。文章还分享了解决react-native-gesture-handler在使用过程中遇到的报错问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

http://www.520webtool.com/

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

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

我的项目原因:   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  选中添加;

 

图1

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

图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')

 

图3

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

 

图4

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

 

图5

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



作者:太阳的小号
链接:https://www.jianshu.com/p/d5bdf455db47
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值