@umituz/react-native-subscription 2.41.9 → 2.41.11

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.41.9",
3
+ "version": "2.41.11",
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",
@@ -13,6 +13,7 @@ import {
13
13
  ListRenderItem,
14
14
  StatusBar,
15
15
  } from "react-native";
16
+ import { useNavigation } from "@react-navigation/native";
16
17
  import { AtomicText, AtomicIcon, AtomicSpinner } from "@umituz/react-native-design-system/atoms";
17
18
  import { useSafeAreaInsets } from "@umituz/react-native-design-system/safe-area";
18
19
  import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
@@ -29,6 +30,8 @@ import {
29
30
  import { hasItems } from "../../../shared/utils/arrayUtils";
30
31
 
31
32
  export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) => {
33
+ const navigation = useNavigation();
34
+
32
35
  const {
33
36
  onClose,
34
37
  translations,
@@ -51,11 +54,20 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
51
54
  const tokens = useAppDesignTokens();
52
55
  const insets = useSafeAreaInsets();
53
56
 
54
- const {
55
- selectedPlanId,
56
- setSelectedPlanId,
57
- isProcessing,
58
- handlePurchase,
57
+ // Default close handler using navigation
58
+ const handleClose = useCallback(() => {
59
+ if (onClose) {
60
+ onClose();
61
+ } else if (navigation.canGoBack()) {
62
+ navigation.goBack();
63
+ }
64
+ }, [onClose, navigation]);
65
+
66
+ const {
67
+ selectedPlanId,
68
+ setSelectedPlanId,
69
+ isProcessing,
70
+ handlePurchase,
59
71
  handleRestore,
60
72
  resetState
61
73
  } = usePaywallActions({
@@ -66,7 +78,7 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
66
78
  onPurchaseSuccess,
67
79
  onPurchaseError,
68
80
  onAuthRequired,
69
- onClose
81
+ onClose: handleClose
70
82
  });
71
83
 
72
84
  // Reset state when screen is closed to avoid lockups
@@ -235,7 +247,7 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
235
247
  zIndex: 10,
236
248
  }}>
237
249
  <TouchableOpacity
238
- onPress={onClose}
250
+ onPress={handleClose}
239
251
  style={[styles.closeBtn, { backgroundColor: tokens.colors.surfaceSecondary }]}
240
252
  activeOpacity={0.7}
241
253
  >
@@ -4,7 +4,7 @@ import type { SubscriptionFeature, PaywallTranslations, PaywallLegalUrls } from
4
4
  import type { PurchaseSource } from "../../subscription/core/SubscriptionConstants";
5
5
 
6
6
  export interface PaywallScreenProps {
7
- onClose: () => void;
7
+ onClose?: () => void;
8
8
  translations: PaywallTranslations;
9
9
  packages?: PurchasesPackage[];
10
10
  features?: SubscriptionFeature[];