@umituz/react-native-subscription 2.24.7 → 2.24.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.24.7",
3
+ "version": "2.24.8",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -4,10 +4,13 @@
4
4
  */
5
5
 
6
6
  import { useCallback, useRef, useEffect } from "react";
7
+ import { InteractionManager } from "react-native";
7
8
  import { useAuthGate } from "./useAuthGate";
8
9
  import { useSubscriptionGate } from "./useSubscriptionGate";
9
10
  import { useCreditsGate } from "./useCreditsGate";
10
11
 
12
+ declare const __DEV__: boolean;
13
+
11
14
 
12
15
 
13
16
  export interface UseFeatureGateParams {
@@ -78,6 +81,7 @@ export function useFeatureGate(
78
81
  }, [onShowPaywall]);
79
82
 
80
83
  // Execute pending action when credits increase after purchase
84
+ // Delay execution to allow paywall modal to fully close and prevent RN Modal conflicts
81
85
  useEffect(() => {
82
86
  const prevBalance = prevCreditBalanceRef.current;
83
87
  const currentBalance = creditBalance;
@@ -87,7 +91,21 @@ export function useFeatureGate(
87
91
  const action = pendingActionRef.current;
88
92
  pendingActionRef.current = null;
89
93
  isWaitingForPurchaseRef.current = false;
90
- action();
94
+
95
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
96
+ console.log("[useFeatureGate] Credits increased, executing pending action with delay");
97
+ }
98
+
99
+ // Wait for paywall modal to fully close before executing pending action
100
+ // This prevents React Native Modal conflicts
101
+ InteractionManager.runAfterInteractions(() => {
102
+ setTimeout(() => {
103
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
104
+ console.log("[useFeatureGate] Executing pending action now");
105
+ }
106
+ action();
107
+ }, 300);
108
+ });
91
109
  }
92
110
 
93
111
  prevCreditBalanceRef.current = creditBalance;
@@ -121,7 +139,13 @@ export function useFeatureGate(
121
139
  const postAuthAction = () => {
122
140
  // Step 2: Subscription check (bypasses credits if subscribed)
123
141
  if (hasSubscriptionRef.current) {
124
- action();
142
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
143
+ console.log("[useFeatureGate] User has subscription, executing with delay");
144
+ }
145
+ // Wait for auth modal to fully close
146
+ InteractionManager.runAfterInteractions(() => {
147
+ setTimeout(() => action(), 300);
148
+ });
125
149
  return;
126
150
  }
127
151
 
@@ -133,8 +157,13 @@ export function useFeatureGate(
133
157
  return;
134
158
  }
135
159
 
136
- // All checks passed
137
- action();
160
+ // All checks passed - wait for auth modal to fully close
161
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
162
+ console.log("[useFeatureGate] User has credits, executing with delay");
163
+ }
164
+ InteractionManager.runAfterInteractions(() => {
165
+ setTimeout(() => action(), 300);
166
+ });
138
167
  };
139
168
  onShowAuthModal(postAuthAction);
140
169
  return;