RevenueCat / RevenueCat/react-native-purchases
NativeModules.RNPurchases is null on React Native 0.81 + Expo SDK 54 with New Architecture enabled
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 117
- Avg merge
- 14h 40m
- Merged PRs (30d)
- 40
Description
- [ x] I have updated Purchases SDK to the latest version
- [ x] I have read the Contribution Guidelines
- [x ] I have searched the Community
- [ x] I have read docs.revenuecat.com
- [ x] I have searched for existing Github issues
Describe the bug
A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.
NativeModules.RNPurchases is null at runtime. The SDK cannot be configured and all calls throw:
Error: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance.
1. Environment
- Platform: iOS
- SDK version: react-native-purchases 10.0.1, react-native-purchases-ui 10.0.1
- OS version: iOS 18
- Xcode version: 16
- React Native version: 0.81.5
- SDK installation: CocoaPods (via npx expo install + pod install)
- How widespread: 100% of devices when running Expo SDK 54 + expo-router 6.x with New Architecture enabled
2. Debug logs that reproduce the issue
WARN [RevenueCat] isConfigured() returning false: Native module not available
ERROR [RevenueCat] configure failed: [TypeError: Cannot read property 'setLogLevel' of null]
ERROR [Paywall] getOfferings error: [Error: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance. https://errors.rev.cat/configuring-sdk]
4. Steps to reproduce, with a description of expected vs. actual behavior
- Create an Expo SDK 54 app using expo-router 6.x (follows RC's own Expo installation guide at https://www.revenuecat.com/docs/getting-started/installation/expo)
- Install react-native-purchases and react-native-purchases-ui via
npx expo install - Run pod install and build with
npx expo run:ios - Call
Purchases.configure({ apiKey })on app startup
Expected:
- SDK configures successfully,
getOfferings()andpurchasePackage()work normally.
Actual:
NativeModules.RNPurchasesis null.configure()throwsCannot read property 'setLogLevel' of null. All subsequent SDK calls throw "no singleton instance."
Root cause:
react-native-purchasesusesRCT_EXPORT_MODULE()(old bridge). In RN 0.81 + Expo SDK 54 with New Architecture, old bridge modules are not registered. the generatedRCTModuleProviders.mmdoes not includeRNPurchases, soNativeModules.RNPurchasesis null at runtime.
New Architecture cannot be disabled: expo-router@6.0.22 depends on react-native-reanimated@4.1.6, which throws a hard error at startup if New Architecture is not enabled ([Reanimated] Reanimated requires the New Architecture). There is no escape from this dependency chain in Expo SDK 54.
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)Additional context
Add any other context about the problem here.
The react-native-purchases iOS source (RNPurchases.m) registers the module with RCT_EXPORT_MODULE() only. There are no TurboModule codegen specs (no .js.flow or NativeModule*.ts spec files), so the module is invisible to the New Architecture module provider system.
Confirmed by inspecting the generated ios/build/generated/ios/RCTModuleProviders.mm — RNPurchases is absent.
Temporary workaround: patching dist/utils/environment.js to return true from shouldUseBrowserMode() when NativeModules.RNPurchases is null, which enables the HTTP-based browser mode. This unblocks development with the RevenueCat Test Store but does not support real App Store purchases.
The fix requires adding TurboModule support to react-native-purchases so the native module is registered via the New Architecture module provider system.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the iOS native module in RNPurchases.m and compare it with the generated ios/build/generated/ios/RCTModuleProviders.mm, where RNPurchases is absent. Review the package's native-module entry points and existing tests before investigating New Architecture registration. Done means NativeModules.RNPurchases is available in the stated Expo SDK 54/RN 0.81 setup and the reported configure and purchase flows work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100