@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.
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
setIsLoading(true);
|
|
46
|
-
setError(null);
|
|
53
|
+
let cancelled = false;
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
const initialize = async () => {
|
|
56
|
+
try {
|
|
57
|
+
setIsLoading(true);
|
|
58
|
+
setError(null);
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
86
|
+
|
|
87
|
+
return () => {
|
|
88
|
+
cancelled = true;
|
|
89
|
+
};
|
|
90
|
+
}, [initializer, skip]);
|
|
73
91
|
|
|
74
92
|
return { isReady, isLoading, error };
|
|
75
93
|
}
|