react-native-gesture-handler: Error: React/RCTEventDispatcher.h not found in iOS
Following the instruction via:
- yarn react-native-gesture-handler
- react-native link react-native-gesture-handler
Then I compiled my Xcode project and got an issue:
Error: React/RCTEventDispatcher.h not found

My environment is: “react”: “16.3.2”, “react-native”: “0.55.3”, “react-native-gesture-handler”: “^1.0.0”,
By the way, is there a pod that I can use for Cocoapod in iOS?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 33 (6 by maintainers)
If you are using react-link to link your dependencies: 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.
@ikzjfr0, Did you try ‘Product->Clean’ in Xcode and then build again?
I faced the same issue and have been able to resolve it.
Now do a clean in XCode and Build the app. You should now also be able to launch the app using react-native run-ios.
Cheers!
Have the same problem with RN 0.59.9
I still failed to use
react-native link react-native-gesture-handlerand got the same error as above. However, I managed to use cocoapod:pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler/ios, hope this is another right way to do that.Moreover, i come to another issue (somebody else feedback this too) : https://github.com/react-native-community/react-native-tab-view/issues/408. I guess this could be potentially related to above issue too.
react-native-tab-viewis usingreact-native-gesture-handleras native drive.The error is removed after I changed from
#import <React/RCTEventDispatcher.h>to#import "RCTEventDispatcher.h". However, I don’t think it’s a good way to do this since I also need to changes hundreds of files from<React/xxxx.h>to"xxxx.h"Ideally, i think, it’s better to use cocoapod way, rather than react-native link
I added #import <React/RCTEventDispatcher.h> in the same file and it works with lots of warning.
I try all thing but still not resolved it please help me.
@hichamnaimi at which point should we add back our pods?
Could you please try remove your Xcode cache and npm cache as well?
@ikzjfr0 I cannot manage to reproduce your issue. I made a new project
react-native init, then:yarn add react-native-gesture-handlerand:react-native link react-native-gesture-handlerand find it workable. I also did change versions of react and RN to be exactly same as yours and build again the project and everything seems to be fine. Would you like to give me the link to repository with sample to project that shows your problem? Would you mind adding version of Xcode you use?