Reputation: 1083
App ran fine on React Native 0.35.0. After updating to 0.40.0 via react-native-git-upgrade
I get a number of lexical/preprocessor issues when trying to build/run the app in XCode.
React/RCTBridgeModule.h' file not found
When clicking on the issue I see this highlighted:
#import <React/RCTBridgeModule.h>
It doesn't appear to be a search path issue.
I've tried deleting node_modules and running npm install
again, but that hasn't fixed anything.
Upvotes: 55
Views: 56979
Reputation: 1
Changing the path from:
#import <React/RCTBridgeModule.h>
to:
#import <React/Base/RCTBridgeModule.h>
worked for me.
Upvotes: 0
Reputation: 31
I had the same issue. I have solved it by removing the Test target of my app from build scheme.
Upvotes: 3
Reputation: 39
If you use pod, maybe you can try this solution:
Go to Header Search Paths:
Pods -> TARGETS -> (YOUR TARGET, like my target is RNGL) -> Build Settings -> All -> Search Paths -> Header Search Paths
add a path:
"${PODS_ROOT}/Headers/Public/React"
non-recursive
Upvotes: 2
Reputation: 147
Update from
to
the clean and build.
Although, I have not tested it, I suspect if I made no changes and just clean and build it would have done the trick.
Upvotes: 0
Reputation: 97
This steps helped solve my issue. I tried "Uncheck parallelize build" steps. It did not work for me.
Upvotes: 1
Reputation: 1
Here is how I made it work:
#import '....h'
that were causing error to the corresponding #import <React/.....h>
.Upvotes: 0
Reputation: 603
If your app isn't to large, just
1) rename original app
2) create the same app again react-native init <orig_app_name>
3) copy over all necessary files from your original app to the newly created one
4) adjust the package.json
5) npm install
6) react-native run-<ios|android>
I spent hours to find, where to link the new libraries, it was at least a valuable option and shortcut for me.
hope it helps somebody
Upvotes: 2
Reputation: 6689
As pointed out by th0th, there is a breaking change in RN 0.40 for iOS. In short, RN header declarations are updated to point to the include path $(BUILT_PRODUCTS_DIR)/include/React
.
To solve the issue, you have to do the following:
Note: You might still have similar header issue with other libraries (e.g. react-native-fbsdk) that are referring to those react native .h files.
Upvotes: 121
Reputation: 20786
In react-native 0.40
you have to replace #import "RCTBridgeModule.h"
with #import <React/RCTBridgeModule.h>
then clean and build it again.
Upvotes: 6
Reputation: 7974
There is a breaking change on 0.40, you can see details here.
Quoting directly from the release notes:
This means that all iOS native libraries need a major version bump for RN 0.40. We attempt to minimize changes of this magnitude, and we apologize for any inconvenience caused.
So, all native iOS libraries will need an update before getting compatible with react-native version 0.40.
Upvotes: 3