I have successfully built a react-native module within a react-native int project. Now I want to extract this module (standalone i.e react-native-my-custom-module) to its own repo, so I can reuse it in other projects and open-source it. I tried using https://github.com/frostney/react-native-create-library to create this standalone react-native module. However, the react-native module has a dependency on external SDK(installed using CocoaPods i.e pod 'Firebase/Core') and due to this, I believe it is Breaking.
What I Tried:
In the standalone Module Repo
- Moved module logic(i.e
.swift.h(header-bridge),.m) files - added
$(SRCROOT)/../../../ios/Pods/**to the Header search Paths - No Pods dependencies(i.e no Podfile, Pods etc)(It made sense to not include Pods in the
<react-native-my-custom-module>and instead install Pods in the Project.)
In the Project
yarn add <react-native-my-custom-module>react-native link <react-native-my-custom-module>- added
pod 'Firebase/Core'in Pod file and ranpod install
Tried to Build project but get an error that at the line import firebase Error: No such module 'Firebase'
Additionally, If I comment out the import statement import firebase and the code using the External SDK, the remaining methods and logic in the Native Module works(confirmed with JS).
Update: I also tried to install <react-native-my-custom-module> using CocoaPods instead on react-native link i.e by adding the following in my Project Pod file
pod 'RNCustomModule', path: '../node_modules/MyCustomReactNativeMidule/ios/RNCustomModule.podspec'
The Pods successfully get installed but I still get the same Error: No such module 'Firebase'