@umituz/react-native-design-system 2.6.6 → 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",
|
|
@@ -64,12 +64,17 @@ 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
|
+
|
|
70
74
|
if (__DEV__) {
|
|
71
75
|
console.log('[DesignSystemProvider] Component render:', {
|
|
72
76
|
isInitialized,
|
|
77
|
+
minDisplayTimeMet,
|
|
73
78
|
showLoadingIndicator,
|
|
74
79
|
hasSplashConfig: !!splashConfig,
|
|
75
80
|
splashConfigKeys: splashConfig ? Object.keys(splashConfig) : [],
|
|
@@ -78,13 +83,19 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
78
83
|
|
|
79
84
|
useEffect(() => {
|
|
80
85
|
if (__DEV__) console.log('[DesignSystemProvider] Initializing...');
|
|
81
|
-
|
|
86
|
+
|
|
82
87
|
// Apply custom colors if provided
|
|
83
88
|
if (customColors) {
|
|
84
89
|
if (__DEV__) console.log('[DesignSystemProvider] Applying custom colors');
|
|
85
90
|
setCustomColors(customColors);
|
|
86
91
|
}
|
|
87
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
|
+
|
|
88
99
|
// Initialize theme store
|
|
89
100
|
initialize()
|
|
90
101
|
.then(() => {
|
|
@@ -99,20 +110,26 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
99
110
|
setIsInitialized(true); // Still render app even on error
|
|
100
111
|
onError?.(error);
|
|
101
112
|
});
|
|
113
|
+
|
|
114
|
+
return () => clearTimeout(displayTimer);
|
|
102
115
|
}, [initialize, customColors, setCustomColors, onInitialized, onError]);
|
|
103
116
|
|
|
104
117
|
const renderContent = () => {
|
|
118
|
+
const shouldShowSplash = showLoadingIndicator && (!isInitialized || !minDisplayTimeMet);
|
|
119
|
+
|
|
105
120
|
if (__DEV__) {
|
|
106
121
|
console.log('[DesignSystemProvider] renderContent:', {
|
|
107
122
|
showLoadingIndicator,
|
|
108
123
|
isInitialized,
|
|
124
|
+
minDisplayTimeMet,
|
|
125
|
+
shouldShowSplash,
|
|
109
126
|
hasSplashConfig: !!splashConfig,
|
|
110
127
|
hasLoadingComponent: !!loadingComponent,
|
|
111
128
|
});
|
|
112
129
|
}
|
|
113
130
|
|
|
114
|
-
// Show loading indicator if requested and not yet
|
|
115
|
-
if (
|
|
131
|
+
// Show loading indicator if requested and not yet ready (both conditions must be met)
|
|
132
|
+
if (shouldShowSplash) {
|
|
116
133
|
if (__DEV__) console.log('[DesignSystemProvider] Showing loading state');
|
|
117
134
|
|
|
118
135
|
if (loadingComponent) {
|