@umituz/react-native-design-system 2.6.3 → 2.6.5

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",
3
+ "version": "2.6.5",
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",
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from 'react';
7
7
  import { StatusBar, StatusBarProps } from 'react-native';
8
- import { useTheme } from '../../theme/hooks/useTheme';
9
- import { useAppDesignTokens } from '../../theme/hooks/useAppDesignTokens';
8
+ import { useTheme } from '../../theme';
9
+ import { useAppDesignTokens } from '../../theme';
10
10
 
11
11
  export interface AtomicStatusBarProps extends Omit<StatusBarProps, 'barStyle' | 'backgroundColor'> {
12
12
  barStyle?: 'auto' | 'light-content' | 'dark-content';
@@ -18,7 +18,7 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
18
18
  icon,
19
19
  appName,
20
20
  tagline,
21
- colors,
21
+ colors: customColors,
22
22
  gradientColors,
23
23
  visible = true,
24
24
  maxDuration,
@@ -27,8 +27,16 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
27
27
  style,
28
28
  }: SplashScreenProps) => {
29
29
  const insets = useSafeAreaInsets();
30
+ const tokens = useAppDesignTokens();
30
31
  const [timedOut, setTimedOut] = useState(false);
31
32
 
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
+
32
40
  const handleTimeout = useCallback(() => {
33
41
  if (__DEV__) {
34
42
  console.log(`[SplashScreen] Timeout reached: ${maxDuration}ms`);
@@ -97,6 +105,15 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
97
105
  </AtomicText>
98
106
  ) : null}
99
107
 
108
+ {/* Always show loading indicator during initialization */}
109
+ <View style={styles.loadingContainer}>
110
+ <ActivityIndicator
111
+ size="large"
112
+ color={colors.text}
113
+ style={styles.loadingIndicator}
114
+ />
115
+ </View>
116
+
100
117
  {timedOut && __DEV__ ? (
101
118
  <AtomicText
102
119
  type="labelSmall"
@@ -163,6 +180,15 @@ const styles = StyleSheet.create({
163
180
  textAlign: "center",
164
181
  opacity: 0.9,
165
182
  },
183
+ loadingContainer: {
184
+ marginTop: SPLASH_CONSTANTS.CONTENT_PADDING,
185
+ alignItems: "center",
186
+ justifyContent: "center",
187
+ minHeight: 40,
188
+ },
189
+ loadingIndicator: {
190
+ opacity: 0.8,
191
+ },
166
192
  timeoutText: {
167
193
  textAlign: "center",
168
194
  marginTop: 16,
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Splash Hooks
3
+ */
4
+
5
+ export { useSplashFlow } from './useSplashFlow';
6
+ export type { UseSplashFlowOptions, UseSplashFlowResult } from './useSplashFlow';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Splash Flow Hook
3
+ * Manages splash screen initialization state
4
+ */
5
+
6
+ import { useState, useEffect } from 'react';
7
+ import { DeviceEventEmitter } from 'react-native';
8
+
9
+ export interface UseSplashFlowOptions {
10
+ duration?: number;
11
+ }
12
+
13
+ export interface UseSplashFlowResult {
14
+ isInitialized: boolean;
15
+ }
16
+
17
+ export const useSplashFlow = (options: UseSplashFlowOptions = {}): UseSplashFlowResult => {
18
+ const { duration = 1500 } = options;
19
+ const [isInitialized, setIsInitialized] = useState(false);
20
+
21
+ useEffect(() => {
22
+ const timer = setTimeout(() => {
23
+ setIsInitialized(true);
24
+ DeviceEventEmitter.emit('splash-ready');
25
+ }, duration);
26
+
27
+ return () => clearTimeout(timer);
28
+ }, [duration]);
29
+
30
+ return { isInitialized };
31
+ };
@@ -8,3 +8,6 @@ export type {
8
8
  SplashScreenProps,
9
9
  SplashColors,
10
10
  } from './types';
11
+
12
+ export { useSplashFlow } from './hooks';
13
+ export type { UseSplashFlowOptions, UseSplashFlowResult } from './hooks';
@@ -98,7 +98,7 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
98
98
  }
99
99
 
100
100
  // Use SplashScreen if config provided, otherwise fallback to ActivityIndicator
101
- if (splashConfig?.colors) {
101
+ if (splashConfig) {
102
102
  return <SplashScreen {...splashConfig} />;
103
103
  }
104
104