Context
We would like to use this SDK in a bare React Native project, but expo is listed as a peer dependency, which prevents this.
Investigation findings
After a full investigation including runtime testing, the Expo dependency is deeper than initially apparent. There are two layers:
1. JS layer — requireNativeModule from expo
src/CookieInformationRNSDKModule.ts imports requireNativeModule from expo to access the native module. Replacing this with NativeModules from react-native is technically straightforward, but it does not work as long as the native modules are built on ExpoModulesCore — because ExpoModulesCore registers modules in its own system, separate from the classic React Native bridge. NativeModules.CookieInformationRNSDK returns null at runtime.
2. Native layer — ExpoModulesCore (the real dependency)
Both native implementations extend Expo's module system:
- iOS (
ios/CookieInformationRNSDKModule.swift): import ExpoModulesCore, extends Module
- Android (
android/src/main/java/expo/modules/mobileconsentssdk/CookieInformationRNSDKModule.kt): package expo.modules.mobileconsentssdk, uses Expo module registration
This is the root cause. expo-modules-core must be present as a native dependency regardless of what the JS layer does.
What a real fix requires
To remove the Expo peer dependency entirely, both native modules need to be rewritten using the standard React Native bridge:
- iOS: Replace
ExpoModulesCore with RCTBridgeModule / RCTEventEmitter
- Android: Replace Expo module registration with a standard
ReactPackage + ReactContextBaseJavaModule
The JS layer change (requireNativeModule → NativeModules) follows naturally once the native side is updated.
Current workaround
None — bare React Native projects without expo-modules-core cannot use this SDK today.
Would you be open to rewriting the native modules to use the standard React Native bridge?
Context
We would like to use this SDK in a bare React Native project, but
expois listed as a peer dependency, which prevents this.Investigation findings
After a full investigation including runtime testing, the Expo dependency is deeper than initially apparent. There are two layers:
1. JS layer —
requireNativeModulefromexposrc/CookieInformationRNSDKModule.tsimportsrequireNativeModulefromexpoto access the native module. Replacing this withNativeModulesfromreact-nativeis technically straightforward, but it does not work as long as the native modules are built on ExpoModulesCore — because ExpoModulesCore registers modules in its own system, separate from the classic React Native bridge.NativeModules.CookieInformationRNSDKreturnsnullat runtime.2. Native layer — ExpoModulesCore (the real dependency)
Both native implementations extend Expo's module system:
ios/CookieInformationRNSDKModule.swift):import ExpoModulesCore, extendsModuleandroid/src/main/java/expo/modules/mobileconsentssdk/CookieInformationRNSDKModule.kt): packageexpo.modules.mobileconsentssdk, uses Expo module registrationThis is the root cause.
expo-modules-coremust be present as a native dependency regardless of what the JS layer does.What a real fix requires
To remove the Expo peer dependency entirely, both native modules need to be rewritten using the standard React Native bridge:
ExpoModulesCorewithRCTBridgeModule/RCTEventEmitterReactPackage+ReactContextBaseJavaModuleThe JS layer change (
requireNativeModule→NativeModules) follows naturally once the native side is updated.Current workaround
None — bare React Native projects without
expo-modules-corecannot use this SDK today.Would you be open to rewriting the native modules to use the standard React Native bridge?