@umituz/react-native-design-system 2.6.5 → 2.6.7
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.6.
|
|
3
|
+
"version": "2.6.7",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -37,6 +37,18 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
|
|
|
37
37
|
iconPlaceholder: `${tokens.colors.textPrimary}30`, // 30% opacity
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
if (__DEV__) {
|
|
41
|
+
console.log('[SplashScreen] Component render:', {
|
|
42
|
+
visible,
|
|
43
|
+
appName,
|
|
44
|
+
tagline,
|
|
45
|
+
hasIcon: !!icon,
|
|
46
|
+
hasCustomColors: !!customColors,
|
|
47
|
+
resolvedColors: colors,
|
|
48
|
+
hasGradient: !!gradientColors,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
const handleTimeout = useCallback(() => {
|
|
41
53
|
if (__DEV__) {
|
|
42
54
|
console.log(`[SplashScreen] Timeout reached: ${maxDuration}ms`);
|
|
@@ -61,11 +73,15 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
|
|
|
61
73
|
|
|
62
74
|
if (!visible) {
|
|
63
75
|
if (__DEV__) {
|
|
64
|
-
console.log("[SplashScreen] Not visible, returning null");
|
|
76
|
+
console.log("[SplashScreen] Not visible (visible=false), returning null");
|
|
65
77
|
}
|
|
66
78
|
return null;
|
|
67
79
|
}
|
|
68
80
|
|
|
81
|
+
if (__DEV__) {
|
|
82
|
+
console.log("[SplashScreen] Rendering splash screen UI");
|
|
83
|
+
}
|
|
84
|
+
|
|
69
85
|
const iconPlaceholderColor = colors.iconPlaceholder ?? `${colors.text}30`;
|
|
70
86
|
|
|
71
87
|
const contentStyle = {
|
|
@@ -64,44 +64,86 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
64
64
|
onError,
|
|
65
65
|
}: DesignSystemProviderProps) => {
|
|
66
66
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
67
|
+
const [minDisplayTimeMet, setMinDisplayTimeMet] = useState(false);
|
|
67
68
|
const initialize = useThemeStore((state) => state.initialize);
|
|
68
69
|
const setCustomColors = useDesignSystemTheme((state) => state.setCustomColors);
|
|
69
70
|
|
|
71
|
+
// Minimum splash display time (1.5 seconds)
|
|
72
|
+
const MIN_SPLASH_DISPLAY_TIME = 1500;
|
|
73
|
+
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
console.log('[DesignSystemProvider] Component render:', {
|
|
76
|
+
isInitialized,
|
|
77
|
+
minDisplayTimeMet,
|
|
78
|
+
showLoadingIndicator,
|
|
79
|
+
hasSplashConfig: !!splashConfig,
|
|
80
|
+
splashConfigKeys: splashConfig ? Object.keys(splashConfig) : [],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
70
84
|
useEffect(() => {
|
|
71
85
|
if (__DEV__) console.log('[DesignSystemProvider] Initializing...');
|
|
72
|
-
|
|
86
|
+
|
|
73
87
|
// Apply custom colors if provided
|
|
74
88
|
if (customColors) {
|
|
75
89
|
if (__DEV__) console.log('[DesignSystemProvider] Applying custom colors');
|
|
76
90
|
setCustomColors(customColors);
|
|
77
91
|
}
|
|
78
92
|
|
|
93
|
+
// Start minimum display timer
|
|
94
|
+
const displayTimer = setTimeout(() => {
|
|
95
|
+
if (__DEV__) console.log('[DesignSystemProvider] Minimum display time met (1.5s)');
|
|
96
|
+
setMinDisplayTimeMet(true);
|
|
97
|
+
}, MIN_SPLASH_DISPLAY_TIME);
|
|
98
|
+
|
|
79
99
|
// Initialize theme store
|
|
80
100
|
initialize()
|
|
81
101
|
.then(() => {
|
|
82
|
-
if (__DEV__) console.log('[DesignSystemProvider] Initialized successfully');
|
|
102
|
+
if (__DEV__) console.log('[DesignSystemProvider] Initialized successfully - setting isInitialized to true');
|
|
83
103
|
setIsInitialized(true);
|
|
104
|
+
if (__DEV__) console.log('[DesignSystemProvider] State updated - calling onInitialized callback');
|
|
84
105
|
onInitialized?.();
|
|
85
106
|
})
|
|
86
107
|
.catch((error) => {
|
|
87
108
|
if (__DEV__) console.error('[DesignSystemProvider] Initialization failed:', error);
|
|
109
|
+
if (__DEV__) console.log('[DesignSystemProvider] Error occurred - setting isInitialized to true anyway');
|
|
88
110
|
setIsInitialized(true); // Still render app even on error
|
|
89
111
|
onError?.(error);
|
|
90
112
|
});
|
|
113
|
+
|
|
114
|
+
return () => clearTimeout(displayTimer);
|
|
91
115
|
}, [initialize, customColors, setCustomColors, onInitialized, onError]);
|
|
92
116
|
|
|
93
117
|
const renderContent = () => {
|
|
94
|
-
|
|
95
|
-
|
|
118
|
+
const shouldShowSplash = showLoadingIndicator && (!isInitialized || !minDisplayTimeMet);
|
|
119
|
+
|
|
120
|
+
if (__DEV__) {
|
|
121
|
+
console.log('[DesignSystemProvider] renderContent:', {
|
|
122
|
+
showLoadingIndicator,
|
|
123
|
+
isInitialized,
|
|
124
|
+
minDisplayTimeMet,
|
|
125
|
+
shouldShowSplash,
|
|
126
|
+
hasSplashConfig: !!splashConfig,
|
|
127
|
+
hasLoadingComponent: !!loadingComponent,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Show loading indicator if requested and not yet ready (both conditions must be met)
|
|
132
|
+
if (shouldShowSplash) {
|
|
133
|
+
if (__DEV__) console.log('[DesignSystemProvider] Showing loading state');
|
|
134
|
+
|
|
96
135
|
if (loadingComponent) {
|
|
136
|
+
if (__DEV__) console.log('[DesignSystemProvider] Rendering custom loading component');
|
|
97
137
|
return <>{loadingComponent}</>;
|
|
98
138
|
}
|
|
99
|
-
|
|
139
|
+
|
|
100
140
|
// Use SplashScreen if config provided, otherwise fallback to ActivityIndicator
|
|
101
141
|
if (splashConfig) {
|
|
142
|
+
if (__DEV__) console.log('[DesignSystemProvider] Rendering SplashScreen with config:', splashConfig);
|
|
102
143
|
return <SplashScreen {...splashConfig} />;
|
|
103
144
|
}
|
|
104
145
|
|
|
146
|
+
if (__DEV__) console.log('[DesignSystemProvider] Rendering fallback ActivityIndicator');
|
|
105
147
|
return (
|
|
106
148
|
<View style={styles.loadingContainer}>
|
|
107
149
|
<ActivityIndicator size="large" />
|
|
@@ -109,6 +151,7 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
109
151
|
);
|
|
110
152
|
}
|
|
111
153
|
|
|
154
|
+
if (__DEV__) console.log('[DesignSystemProvider] Rendering children (app initialized)');
|
|
112
155
|
return <>{children}</>;
|
|
113
156
|
};
|
|
114
157
|
|