react-native-purchases 10.2.0 → 10.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '18.8.0'
28
+ spec.dependency "PurchasesHybridCommon", '18.10.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '10.2.0'
32
+ versionName '10.2.2'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
121
121
  dependencies {
122
122
  //noinspection GradleDynamicVersion
123
123
  api 'com.facebook.react:react-native:+'
124
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.8.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.10.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -51,7 +51,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
51
51
  private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
52
52
  private static final String DEBUG_EVENT = "Purchases-DebugEvent";
53
53
  public static final String PLATFORM_NAME = "react-native";
54
- public static final String PLUGIN_VERSION = "10.2.0";
54
+ public static final String PLUGIN_VERSION = "10.2.2";
55
55
 
56
56
  private final ReactApplicationContext reactContext;
57
57
 
package/dist/purchases.js CHANGED
@@ -64,6 +64,11 @@ var NATIVE_MODULE_ERROR = "[RevenueCat] Native module (RNPurchases) not found. T
64
64
  var usingBrowserMode = (0, environment_1.shouldUseBrowserMode)();
65
65
  var RNPurchases = usingBrowserMode ? nativeModule_1.browserNativeModuleRNPurchases : react_native_1.NativeModules.RNPurchases;
66
66
  // Only create event emitter if native module is available to avoid crash on import
67
+ //
68
+ // React Native 0.79+ requires native modules to implement addListener() and removeListeners()
69
+ // methods for NativeEventEmitter to work. Both iOS and Android native modules now have these.
70
+ // See: https://github.com/RevenueCat/react-native-purchases/issues/1298
71
+ // See: https://reactnative.dev/blog/2025/04/08/react-native-0.79 (Breaking Changes section)
67
72
  var eventEmitter = !usingBrowserMode && RNPurchases ? new react_native_1.NativeEventEmitter(RNPurchases) : null;
68
73
  // Helper function to check if native module is available - provides better error message than "Cannot read property X of null"
69
74
  function throwIfNativeModuleNotAvailable() {
package/ios/RNPurchases.m CHANGED
@@ -55,6 +55,27 @@ NSString *RNPurchasesDebugEvent = @"Purchases-DebugEvent";
55
55
 
56
56
  RCT_EXPORT_MODULE();
57
57
 
58
+ // Required for RN 0.79+ NativeEventEmitter (JavaScript class) support
59
+ //
60
+ // In JavaScript: new NativeEventEmitter(RNPurchases)
61
+ // NativeEventEmitter checks if the native module has addListener/removeListeners methods.
62
+ // Without these exported methods, construction throws in RN 0.79+.
63
+ //
64
+ // WHY export them here when our parent class RCTEventEmitter already has them?
65
+ // React Native's bridge only exposes methods that are EXPLICITLY exported with RCT_EXPORT_METHOD.
66
+ // Parent class methods are NOT automatically visible to JavaScript. We must re-export them here
67
+ // to make them callable from JS, then call [super] to use the parent's implementation.
68
+ //
69
+ // See: https://github.com/RevenueCat/react-native-purchases/issues/1298
70
+ // See: https://github.com/facebook/react-native/blob/main/packages/react-native/React/Modules/RCTEventEmitter.m#L101-L125
71
+ RCT_EXPORT_METHOD(addListener:(NSString *)eventName) {
72
+ [super addListener:eventName];
73
+ }
74
+
75
+ RCT_EXPORT_METHOD(removeListeners:(double)count) {
76
+ [super removeListeners:count];
77
+ }
78
+
58
79
  RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
59
80
  appUserID:(nullable NSString *)appUserID
60
81
  purchasesAreCompletedBy:(nullable NSString *)purchasesAreCompletedBy
@@ -737,7 +758,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
737
758
  }
738
759
 
739
760
  - (NSString *)platformFlavorVersion {
740
- return @"10.2.0";
761
+ return @"10.2.2";
741
762
  }
742
763
 
743
764
  @end
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "10.2.0",
4
+ "version": "10.2.2",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -115,7 +115,7 @@
115
115
  ]
116
116
  },
117
117
  "dependencies": {
118
- "@revenuecat/purchases-js-hybrid-mappings": "18.8.0",
119
- "@revenuecat/purchases-typescript-internal": "18.8.0"
118
+ "@revenuecat/purchases-js-hybrid-mappings": "18.10.0",
119
+ "@revenuecat/purchases-typescript-internal": "18.10.0"
120
120
  }
121
121
  }