Using a static framework like Realm with React-Native installed via Cocoapods

I have a react based project that has two requirements. It needs to work with Airbnb's native navigation library and this requires Realm . I have a time when two libraries will work togeather. Since Native-navigation uses Swift files, this requires the cocoapods based react to be installed as well as other native libraries.

Realm is not cocoapod friendly library, so I follow this basic setup where I start with the airbnb template ReactNativeStarter

. At this point, the project builds and runs, but when I type in Realm, I get an error while building the project that cannot find the React header files .

Here are my steps:

1) Set the area acrossnpm install --save realm

2) Go to /node_modules/realm/react-native/ios/

and drag RealmReact.xcodeproj

to template project ReactNativeStarter

in fileReactNativeStarter.xcworkspace

enter image description here

3) Then I add to the next search path title for Realm React$(SRCROOT)/../../../../ios/Pods/Headers/Public

enter image description here

I think it's worth noting that the / Pods / Headers folder contains nothing. Is this possibly an issue with cocoapods not generating header files for React correctly?

4) I am adding a static library libRealmReact.a

under "Related Structures and Libraries"

enter image description here

5) Finally, I add the $(SRCROOT)/../node_modules/realm/src

ReactNativeStarter project headers to the search paths.enter image description here

Problem . At this point, project creation still results in the following code build error:

/Users/some.guy/ReactNative/SaveAs/node_modules/react-native/React/Base/RCTBridge.h:12:9: file "React / RCTBridgeModule.h" not found

+3


source to share


1 answer


Remove node -module and reinstall. Run this:

  • watchman-del-all
  • rm -rf node_modules /
  • npm install


After that, run: update-native upgrade to reassign your own dependencies to react-native, which should fix your problem and remember to clean up your project in Xcode.

0


source







All Articles