@umituz/react-native-design-system 2.6.7 → 2.6.8

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.7",
3
+ "version": "2.6.8",
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",
@@ -26,29 +26,11 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
26
26
  onReady,
27
27
  style,
28
28
  }: SplashScreenProps) => {
29
+ // ALL HOOKS MUST BE AT THE TOP (Rules of Hooks)
29
30
  const insets = useSafeAreaInsets();
30
31
  const tokens = useAppDesignTokens();
31
32
  const [timedOut, setTimedOut] = useState(false);
32
33
 
33
- // Derive colors from tokens if not provided (theme-aware defaults)
34
- const colors: SplashColors = customColors ?? {
35
- background: tokens.colors.backgroundPrimary,
36
- text: tokens.colors.textPrimary,
37
- iconPlaceholder: `${tokens.colors.textPrimary}30`, // 30% opacity
38
- };
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
-
52
34
  const handleTimeout = useCallback(() => {
53
35
  if (__DEV__) {
54
36
  console.log(`[SplashScreen] Timeout reached: ${maxDuration}ms`);
@@ -71,6 +53,27 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
71
53
  return () => clearTimeout(timer);
72
54
  }, [maxDuration, visible, handleTimeout]);
73
55
 
56
+ // ALL HOOKS ABOVE - NOW SAFE TO USE OTHER LOGIC
57
+
58
+ // Derive colors from tokens if not provided (theme-aware defaults)
59
+ const colors: SplashColors = customColors ?? {
60
+ background: tokens.colors.backgroundPrimary,
61
+ text: tokens.colors.textPrimary,
62
+ iconPlaceholder: `${tokens.colors.textPrimary}30`, // 30% opacity
63
+ };
64
+
65
+ if (__DEV__) {
66
+ console.log('[SplashScreen] Component render:', {
67
+ visible,
68
+ appName,
69
+ tagline,
70
+ hasIcon: !!icon,
71
+ hasCustomColors: !!customColors,
72
+ resolvedColors: colors,
73
+ hasGradient: !!gradientColors,
74
+ });
75
+ }
76
+
74
77
  if (!visible) {
75
78
  if (__DEV__) {
76
79
  console.log("[SplashScreen] Not visible (visible=false), returning null");
@@ -63,24 +63,12 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
63
63
  onInitialized,
64
64
  onError,
65
65
  }: DesignSystemProviderProps) => {
66
+ // ALL HOOKS MUST BE AT THE TOP (Rules of Hooks)
66
67
  const [isInitialized, setIsInitialized] = useState(false);
67
68
  const [minDisplayTimeMet, setMinDisplayTimeMet] = useState(false);
68
69
  const initialize = useThemeStore((state) => state.initialize);
69
70
  const setCustomColors = useDesignSystemTheme((state) => state.setCustomColors);
70
71
 
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
-
84
72
  useEffect(() => {
85
73
  if (__DEV__) console.log('[DesignSystemProvider] Initializing...');
86
74
 
@@ -90,7 +78,8 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
90
78
  setCustomColors(customColors);
91
79
  }
92
80
 
93
- // Start minimum display timer
81
+ // Start minimum display timer (1.5 seconds)
82
+ const MIN_SPLASH_DISPLAY_TIME = 1500;
94
83
  const displayTimer = setTimeout(() => {
95
84
  if (__DEV__) console.log('[DesignSystemProvider] Minimum display time met (1.5s)');
96
85
  setMinDisplayTimeMet(true);
@@ -114,6 +103,18 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
114
103
  return () => clearTimeout(displayTimer);
115
104
  }, [initialize, customColors, setCustomColors, onInitialized, onError]);
116
105
 
106
+ // ALL HOOKS ABOVE - NOW SAFE TO USE OTHER LOGIC
107
+
108
+ if (__DEV__) {
109
+ console.log('[DesignSystemProvider] Component render:', {
110
+ isInitialized,
111
+ minDisplayTimeMet,
112
+ showLoadingIndicator,
113
+ hasSplashConfig: !!splashConfig,
114
+ splashConfigKeys: splashConfig ? Object.keys(splashConfig) : [],
115
+ });
116
+ }
117
+
117
118
  const renderContent = () => {
118
119
  const shouldShowSplash = showLoadingIndicator && (!isInitialized || !minDisplayTimeMet);
119
120