I'm looking at source code of Microsoft's Mobile center SDK for react-native. There are several native modules for react-native, and the recommended way to install them is via Cocoapods.
Now, each module has podspec, but none mention React as dependency. For example, appcenter-crashes.podspec has these dependencies:
s.dependency 'AppCenterReactNativeShared'
s.dependency 'AppCenter/Crashes'
And AppCenterReactNativeShared.podspec has just
s.dependency 'AppCenter/Core', '1.1.0'
Yet the module are react-native bridges and depend on React and import from React in their sources. For example, AppCenterReactNativeCrashes.m has these lines:
#import "AppCenterReactNativeCrashes.h"
// Support React Native headers both in the React namespace, where they are in RN version 0.40+,
// and no namespace, for older versions of React Native
#if __has_include(<React/RCTAssert.h>)
#import <React/RCTAssert.h>
#import <React/RCTBridgeModule.h>
...
Next, in my react-native project I can link mobile center and build and run my app with Podfile like this:
target 'example' do
pod 'AppCenter/Crashes', '~> 1.0.1'
pod 'AppCenter/Analytics', '~> 1.0.1'
pod 'AppCenterReactNativeShared', '~> 1.0.1'
end
Again, I don't need to mention React pod and its subspecs here!
Now in my own react-native native module I have to declare dependencies like:
s.dependency 'React'
s.dependency 'some-other-dependency-my-module-needs'
And then in my app's Podfile I have include React pod:
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'RCTActionSheet',
...
If I don't include React in native module podspec then I get error fatal error: 'React/RCTBridgeModule.h' file not found. If I don't add React to Pofile, then Cocoapods drags deprecated React pod from its repository and the build breaks.
So, my question is how is it possible that mobile center native modules do not have React in their podspecs and how can I get rid of it in my native module?