@umituz/react-native-design-system 2.9.60 → 2.9.62

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-design-system",
3
- "version": "2.9.60",
3
+ "version": "2.9.62",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { Platform } from "react-native";
7
+ import Constants from "expo-constants";
7
8
  import type {
8
9
  EnvConfig,
9
10
  EnvAccessor,
@@ -103,6 +104,18 @@ export function createEnvConfig(
103
104
  };
104
105
 
105
106
  const getRevenueCatApiKey = (): string => {
107
+ // Auto-select test store key in Expo Go (appOwnership === 'expo')
108
+ const isExpoGo = Constants.appOwnership === "expo";
109
+ const testStoreKey = config.revenueCat?.testStoreKey;
110
+
111
+ if (isExpoGo && testStoreKey) {
112
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
113
+ console.log("[createEnvConfig] Using RevenueCat Test Store Key (Expo Go)");
114
+ }
115
+ return testStoreKey;
116
+ }
117
+
118
+ // Use platform-specific production key
106
119
  const platformKey =
107
120
  Platform.OS === "ios"
108
121
  ? config.revenueCat?.iosKey ||
@@ -3,7 +3,7 @@
3
3
  * Manages app initialization state in React components
4
4
  */
5
5
 
6
- import { useState, useEffect, useCallback } from "react";
6
+ import { useState, useEffect, useRef } from "react";
7
7
  import type {
8
8
  UseAppInitializationOptions,
9
9
  UseAppInitializationReturn,
@@ -34,42 +34,60 @@ export function useAppInitialization(
34
34
  const [isLoading, setIsLoading] = useState(!skip);
35
35
  const [error, setError] = useState<Error | null>(null);
36
36
 
37
- const initialize = useCallback(async () => {
37
+ // Store callbacks in refs to avoid re-running effect
38
+ const onReadyRef = useRef(onReady);
39
+ const onErrorRef = useRef(onError);
40
+
41
+ useEffect(() => {
42
+ onReadyRef.current = onReady;
43
+ onErrorRef.current = onError;
44
+ });
45
+
46
+ useEffect(() => {
38
47
  if (skip) {
39
48
  setIsReady(true);
40
49
  setIsLoading(false);
41
50
  return;
42
51
  }
43
52
 
44
- try {
45
- setIsLoading(true);
46
- setError(null);
53
+ let cancelled = false;
47
54
 
48
- const result = await initializer();
55
+ const initialize = async () => {
56
+ try {
57
+ setIsLoading(true);
58
+ setError(null);
49
59
 
50
- if (!result.success && result.failedModules.length > 0) {
51
- const criticalFailed = result.failedModules.length > 0;
52
- if (criticalFailed) {
60
+ const result = await initializer();
61
+
62
+ if (cancelled) return;
63
+
64
+ if (!result.success && result.failedModules.length > 0) {
53
65
  throw new Error(
54
66
  `Initialization failed: ${result.failedModules.join(", ")}`
55
67
  );
56
68
  }
57
- }
58
69
 
59
- setIsReady(true);
60
- onReady?.();
61
- } catch (err) {
62
- const error = err instanceof Error ? err : new Error(String(err));
63
- setError(error);
64
- onError?.(error);
65
- } finally {
66
- setIsLoading(false);
67
- }
68
- }, [initializer, skip, onReady, onError]);
70
+ setIsReady(true);
71
+ onReadyRef.current?.();
72
+ } catch (err) {
73
+ if (cancelled) return;
74
+
75
+ const error = err instanceof Error ? err : new Error(String(err));
76
+ setError(error);
77
+ onErrorRef.current?.(error);
78
+ } finally {
79
+ if (!cancelled) {
80
+ setIsLoading(false);
81
+ }
82
+ }
83
+ };
69
84
 
70
- useEffect(() => {
71
85
  initialize();
72
- }, [initialize]);
86
+
87
+ return () => {
88
+ cancelled = true;
89
+ };
90
+ }, [initializer, skip]);
73
91
 
74
92
  return { isReady, isLoading, error };
75
93
  }
@@ -16,7 +16,7 @@ export interface OnboardingStoreState {
16
16
  export const initialOnboardingState: OnboardingStoreState = {
17
17
  isOnboardingComplete: false,
18
18
  currentStep: 0,
19
- loading: true,
19
+ loading: false,
20
20
  error: null,
21
21
  userData: { answers: {} },
22
22
  };