天天看點

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

來源:簡書

簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權并注明出處。