I am trying to add native dependencies to a blank Expo project for react-native. I keep getting this error after the build in Xcode: ‘React/RCTBridge.h’ file not found
. The particular library I want to use is react-native-camera
, but I have tried other libraries and they don't link correctly either. I can get the libraries to link correctly with projects created with react-native-init
and create-react-native-app
(which has been detached). Here are the steps I took to create and detach from the expo project:
EDIT (I did steps 4,5, and 8 differently for different types of linking)
"ios": {
"bundleIdentifier": "com.yourcompany.yourappname",
"supportsTablet": true
},
"android": {
"package": "com.yourcompany.yourappname"
}
exp detach
npm i [email protected] --save
react-native link
npm i
cd ios
pod install
exp start
I have attempted the following solutions (A, B, C):
A. From: react-native-camera's docs 1)Mostly automatic install with CocoaPods 2)Manual install
B. From : the expo docs
because react-native link is not aware of CocoaPods, it may not do a complete job installing your dependency. If you encounter build issues locating the headers, you may need to manually add Pods/Headers/Public to the Header Search Paths configuration for your native dependency in Xcode...The target you care to configure is the one created by react-native link inside your Xcode project. You’ll want to determine the relative path from your library to Pods/Headers/Public
C. And, finally, I tried This answer from stackoverflow
$(SRCROOT) refers to the native module's source folder rather than the top-level root of the whole project.
I had to use $(SRCROOT)/../../../ios/Pods/Headers/Public based on the location of the native module I ws bringing in (under node_modules).