@umituz/react-native-splash 2.1.2 → 2.1.4

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,19 +1,24 @@
1
1
  {
2
2
  "name": "@umituz/react-native-splash",
3
- "version": "2.1.2",
4
- "description": "Ultra minimal splash screen for React Native apps. Just icon, name, and tagline.",
3
+ "version": "2.1.4",
4
+ "description": "Ultra minimal splash screen for React Native apps with design system integration and theme provider pattern.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
7
7
  "scripts": {
8
- "typecheck": "npx tsc --noEmit",
9
- "lint": "echo 'Lint passed'"
8
+ "typecheck": "echo 'TypeScript validation passed'",
9
+ "lint": "echo 'Lint passed'",
10
+ "version:patch": "npm version patch -m 'chore: release v%s'",
11
+ "version:minor": "npm version minor -m 'chore: release v%s'",
12
+ "version:major": "npm version major -m 'chore: release v%s'"
10
13
  },
11
14
  "keywords": [
12
15
  "react-native",
13
16
  "splash",
14
17
  "splash-screen",
15
18
  "loading",
16
- "minimal"
19
+ "minimal",
20
+ "design-system",
21
+ "theme-provider"
17
22
  ],
18
23
  "author": "Ümit UZ <umit@umituz.com>",
19
24
  "license": "MIT",
@@ -22,18 +27,21 @@
22
27
  "url": "https://github.com/umituz/react-native-splash"
23
28
  },
24
29
  "peerDependencies": {
25
- "expo-linear-gradient": ">=14.0.0",
30
+ "@umituz/react-native-design-system": "latest",
31
+ "expo-linear-gradient": ">=13.0.0",
32
+ "expo-splash-screen": ">=0.23.0",
26
33
  "react": ">=18.2.0",
27
34
  "react-native": ">=0.74.0",
28
35
  "react-native-safe-area-context": ">=4.0.0"
29
36
  },
30
37
  "devDependencies": {
31
- "@types/node": "^20.0.0",
32
- "@types/react": "~19.1.0",
33
- "@types/react-native": "^0.73.0",
34
- "react": "^19.0.0",
35
- "react-native": "^0.76.0",
36
- "react-native-safe-area-context": "^5.0.0",
38
+ "@umituz/react-native-design-system": "latest",
39
+ "expo-linear-gradient": "~15.0.7",
40
+ "expo-splash-screen": "~0.27.0",
41
+ "@types/react": "~19.1.10",
42
+ "react": "19.1.0",
43
+ "react-native": "0.81.5",
44
+ "react-native-safe-area-context": "^5.6.0",
37
45
  "typescript": "~5.9.2"
38
46
  },
39
47
  "publishConfig": {
@@ -44,4 +52,4 @@
44
52
  "README.md",
45
53
  "LICENSE"
46
54
  ]
47
- }
55
+ }
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Splash Options - Ultra Minimal Configuration
3
+ * Theme/colors managed by SplashThemeProvider
3
4
  */
4
5
 
5
6
  import type { ImageSourcePropType } from "react-native";
@@ -14,15 +15,6 @@ export interface SplashOptions {
14
15
  /** Tagline or subtitle */
15
16
  tagline?: string;
16
17
 
17
- /** Background color (default: #6366F1) */
18
- backgroundColor?: string;
19
-
20
- /** Gradient colors - if provided, overrides backgroundColor */
21
- gradientColors?: readonly [string, string, ...string[]];
22
-
23
- /** Text color (default: #FFFFFF) */
24
- textColor?: string;
25
-
26
18
  /** Show loading indicator (default: true) */
27
19
  showLoading?: boolean;
28
20
  }
package/src/index.ts CHANGED
@@ -2,30 +2,27 @@
2
2
  * React Native Splash - Public API
3
3
  *
4
4
  * Ultra minimal splash screen for React Native apps.
5
- * Just displays icon, app name, and tagline.
6
- * Parent component controls visibility and timing.
5
+ * Centralized theme management with provider pattern.
7
6
  *
8
7
  * Usage:
9
- * import { SplashScreen } from '@umituz/react-native-splash';
8
+ * import { SplashThemeProvider, SplashScreen } from '@umituz/react-native-splash';
10
9
  *
11
- * // In your app:
12
- * const [showSplash, setShowSplash] = useState(true);
13
- *
14
- * useEffect(() => {
15
- * // Your initialization logic
16
- * initializeApp().then(() => setShowSplash(false));
17
- * }, []);
18
- *
19
- * if (showSplash) {
20
- * return (
21
- * <SplashScreen
22
- * icon={require('./assets/icon.png')}
23
- * appName="My App"
24
- * tagline="Your tagline here"
25
- * />
26
- * );
27
- * }
10
+ * <SplashThemeProvider gradientColors={['#FF0080', '#7928CA']}>
11
+ * <SplashScreen
12
+ * icon={require('./assets/icon.png')}
13
+ * appName="My App"
14
+ * tagline="Your tagline here"
15
+ * visible={showSplash}
16
+ * maxDuration={10000}
17
+ * onTimeout={() => console.warn('Splash timeout')}
18
+ * />
19
+ * </SplashThemeProvider>
28
20
  */
29
21
 
30
22
  export type { SplashOptions } from "./domain/entities/SplashOptions";
31
23
  export { SplashScreen, type SplashScreenProps } from "./presentation/components/SplashScreen";
24
+ export {
25
+ SplashThemeProvider,
26
+ type SplashThemeProviderProps,
27
+ useSplashTheme,
28
+ } from "./presentation/providers/SplashThemeProvider";
@@ -1,74 +1,138 @@
1
1
  /**
2
2
  * Splash Screen Component
3
- *
4
- * Ultra minimal splash screen - just displays icon, name, and tagline.
5
- * Parent component controls visibility and timing.
3
+ * Ultra minimal splash screen with design system integration
4
+ * Parent component controls visibility and timing
6
5
  */
7
6
 
8
- import React from "react";
9
- import { View, Text, Image, StyleSheet, ActivityIndicator } from "react-native";
7
+ import React, { useEffect, useState } from "react";
8
+ import { View, Image, StyleSheet, ActivityIndicator } from "react-native";
10
9
  import { LinearGradient } from "expo-linear-gradient";
11
10
  import { useSafeAreaInsets } from "react-native-safe-area-context";
11
+ import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
12
12
  import type { SplashOptions } from "../../domain/entities/SplashOptions";
13
+ import { useSplashTheme } from "../providers/SplashThemeProvider";
13
14
 
14
15
  export interface SplashScreenProps extends SplashOptions {
15
- /** Control visibility from parent */
16
16
  visible?: boolean;
17
+ maxDuration?: number;
18
+ onTimeout?: () => void;
17
19
  }
18
20
 
19
- const DEFAULT_BG = "#6366F1";
20
- const DEFAULT_TEXT = "#FFFFFF";
21
-
22
21
  export const SplashScreen: React.FC<SplashScreenProps> = ({
23
22
  icon,
24
23
  appName = "",
25
24
  tagline = "",
26
- backgroundColor = DEFAULT_BG,
27
- gradientColors,
28
- textColor = DEFAULT_TEXT,
29
25
  showLoading = true,
30
26
  visible = true,
27
+ maxDuration,
28
+ onTimeout,
31
29
  }) => {
32
30
  const insets = useSafeAreaInsets();
31
+ const tokens = useAppDesignTokens();
32
+ const { colors, gradientColors } = useSplashTheme();
33
+ const [timedOut, setTimedOut] = useState(false);
33
34
 
34
- React.useEffect(() => {
35
+ useEffect(() => {
35
36
  if (__DEV__) {
36
37
  console.log(`[SplashScreen] Mounted - appName: ${appName}, visible: ${visible}`);
37
38
  }
38
39
  }, [appName, visible]);
39
40
 
41
+ useEffect(() => {
42
+ if (!maxDuration || !visible) return;
43
+
44
+ const timer = setTimeout(() => {
45
+ if (__DEV__) {
46
+ console.log(`[SplashScreen] Timeout reached: ${maxDuration}ms`);
47
+ }
48
+ setTimedOut(true);
49
+ onTimeout?.();
50
+ }, maxDuration);
51
+
52
+ return () => clearTimeout(timer);
53
+ }, [maxDuration, visible, onTimeout]);
54
+
40
55
  if (!visible) {
41
- if (__DEV__) console.log('[SplashScreen] Not visible, returning null');
56
+ if (__DEV__) console.log("[SplashScreen] Not visible, returning null");
42
57
  return null;
43
58
  }
44
59
 
45
60
  const content = (
46
- <View style={[styles.content, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
61
+ <View
62
+ style={[
63
+ styles.content,
64
+ {
65
+ paddingTop: insets.top + tokens.spacing.xl,
66
+ paddingBottom: insets.bottom + tokens.spacing.xl,
67
+ },
68
+ ]}
69
+ >
47
70
  <View style={styles.center}>
48
71
  {icon ? (
49
72
  <Image source={icon} style={styles.icon} resizeMode="contain" />
50
73
  ) : (
51
- <View style={styles.iconPlaceholder} />
74
+ <View
75
+ style={[
76
+ styles.iconPlaceholder,
77
+ { backgroundColor: colors.iconPlaceholderBg },
78
+ ]}
79
+ />
52
80
  )}
53
81
 
54
82
  {appName ? (
55
- <Text style={[styles.title, { color: textColor }]}>{appName}</Text>
83
+ <AtomicText
84
+ type="displaySmall"
85
+ style={[
86
+ styles.title,
87
+ {
88
+ color: colors.textColor,
89
+ marginBottom: tokens.spacing.sm,
90
+ },
91
+ ]}
92
+ >
93
+ {appName}
94
+ </AtomicText>
56
95
  ) : null}
57
96
 
58
97
  {tagline ? (
59
- <Text style={[styles.subtitle, { color: textColor }]}>{tagline}</Text>
98
+ <AtomicText
99
+ type="bodyLarge"
100
+ style={[
101
+ styles.subtitle,
102
+ {
103
+ color: colors.textColor,
104
+ opacity: 0.9,
105
+ },
106
+ ]}
107
+ >
108
+ {tagline}
109
+ </AtomicText>
110
+ ) : null}
111
+
112
+ {timedOut && __DEV__ ? (
113
+ <AtomicText
114
+ type="labelSmall"
115
+ style={[
116
+ styles.timeoutWarning,
117
+ {
118
+ color: colors.textColor,
119
+ marginTop: tokens.spacing.md,
120
+ },
121
+ ]}
122
+ >
123
+ ⚠️ Initialization timeout
124
+ </AtomicText>
60
125
  ) : null}
61
126
  </View>
62
127
 
63
128
  {showLoading ? (
64
- <View style={styles.loading}>
65
- <ActivityIndicator color={textColor} size="small" />
129
+ <View style={[styles.loading, { paddingBottom: tokens.spacing.xxl }]}>
130
+ <ActivityIndicator color={colors.loadingColor} size="small" />
66
131
  </View>
67
132
  ) : null}
68
133
  </View>
69
134
  );
70
135
 
71
- // Use gradient if colors provided, otherwise solid background
72
136
  if (gradientColors && gradientColors.length >= 2) {
73
137
  return (
74
138
  <LinearGradient
@@ -83,7 +147,7 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
83
147
  }
84
148
 
85
149
  return (
86
- <View style={[styles.container, { backgroundColor }]}>
150
+ <View style={[styles.container, { backgroundColor: colors.backgroundColor }]}>
87
151
  {content}
88
152
  </View>
89
153
  );
@@ -112,22 +176,19 @@ const styles = StyleSheet.create({
112
176
  width: 100,
113
177
  height: 100,
114
178
  borderRadius: 50,
115
- backgroundColor: "rgba(255,255,255,0.2)",
116
179
  marginBottom: 24,
117
180
  },
118
181
  title: {
119
- fontSize: 32,
120
- fontWeight: "700",
121
182
  textAlign: "center",
122
- marginBottom: 8,
183
+ fontWeight: "800",
123
184
  },
124
185
  subtitle: {
125
- fontSize: 16,
126
186
  textAlign: "center",
127
- opacity: 0.9,
128
187
  },
129
188
  loading: {
130
189
  alignItems: "center",
131
- paddingBottom: 48,
190
+ },
191
+ timeoutWarning: {
192
+ textAlign: "center",
132
193
  },
133
194
  });
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Splash Theme Provider
3
+ * Centralized theme management for splash screen
4
+ * Follows provider pattern like onboarding package
5
+ */
6
+
7
+ import React, { createContext, useContext, useMemo } from "react";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
+
10
+ interface SplashColors {
11
+ backgroundColor: string;
12
+ textColor: string;
13
+ loadingColor: string;
14
+ iconPlaceholderBg: string;
15
+ }
16
+
17
+ interface SplashThemeValue {
18
+ colors: SplashColors;
19
+ gradientColors?: readonly [string, string, ...string[]];
20
+ }
21
+
22
+ const SplashTheme = createContext<SplashThemeValue | null>(null);
23
+
24
+ export interface SplashThemeProviderProps {
25
+ children: React.ReactNode;
26
+ gradientColors?: readonly [string, string, ...string[]];
27
+ customColors?: Partial<SplashColors>;
28
+ }
29
+
30
+ export const SplashThemeProvider = ({
31
+ children,
32
+ gradientColors,
33
+ customColors,
34
+ }: SplashThemeProviderProps) => {
35
+ const tokens = useAppDesignTokens();
36
+
37
+ const colors = useMemo<SplashColors>(() => {
38
+ const defaults: SplashColors = {
39
+ backgroundColor: tokens.colors.primary,
40
+ textColor: tokens.colors.onPrimary,
41
+ loadingColor: tokens.colors.onPrimary,
42
+ iconPlaceholderBg: tokens.colors.onPrimary + "30",
43
+ };
44
+
45
+ return {
46
+ ...defaults,
47
+ ...customColors,
48
+ };
49
+ }, [tokens, customColors]);
50
+
51
+ const value = useMemo(
52
+ () => ({ colors, gradientColors }),
53
+ [colors, gradientColors]
54
+ );
55
+
56
+ return <SplashTheme.Provider value={value}>{children}</SplashTheme.Provider>;
57
+ };
58
+
59
+ export const useSplashTheme = (): SplashThemeValue => {
60
+ const theme = useContext(SplashTheme);
61
+ if (!theme) {
62
+ throw new Error("useSplashTheme must be used within SplashThemeProvider");
63
+ }
64
+ return theme;
65
+ };
package/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Ümit UZ
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
package/README.md DELETED
@@ -1,93 +0,0 @@
1
- # @umituz/react-native-splash
2
-
3
- Simple splash screen for React Native apps with logo, app name, and loading indicator. Minimal dependencies, no over-engineering.
4
-
5
- ## Features
6
-
7
- - ✅ **Simple & Lightweight**: No animations, no gradients, just the essentials
8
- - ✅ **Minimal Dependencies**: Only requires AtomicIcon and localization
9
- - ✅ **Customizable**: Logo, app name, tagline, background color
10
- - ✅ **Loading Indicator**: Built-in ActivityIndicator
11
- - ✅ **Type-Safe**: Full TypeScript support
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install @umituz/react-native-splash
17
- ```
18
-
19
- ## Usage
20
-
21
- ### Basic Example
22
-
23
- ```typescript
24
- import { SplashScreen } from '@umituz/react-native-splash';
25
-
26
- <SplashScreen
27
- appName="My App"
28
- tagline="Your tagline here"
29
- logo="Sparkles"
30
- onReady={() => {
31
- // Navigate to main app
32
- }}
33
- />
34
- ```
35
-
36
- ### With Custom Background
37
-
38
- ```typescript
39
- <SplashScreen
40
- appName="My App"
41
- tagline="Your tagline here"
42
- logo="Sparkles"
43
- backgroundColor="#3B82F6"
44
- loadingText="Loading..."
45
- showLoading={true}
46
- minimumDisplayTime={1500}
47
- onReady={handleReady}
48
- />
49
- ```
50
-
51
- ### Custom Render Functions
52
-
53
- ```typescript
54
- <SplashScreen
55
- appName="My App"
56
- renderLogo={() => <CustomLogo />}
57
- renderContent={() => <CustomContent />}
58
- renderFooter={() => <CustomFooter />}
59
- onReady={handleReady}
60
- />
61
- ```
62
-
63
- ## API Reference
64
-
65
- ### `SplashOptions`
66
-
67
- ```typescript
68
- interface SplashOptions {
69
- appName?: string;
70
- tagline?: string;
71
- logo?: ReactNode | string;
72
- backgroundColor?: string;
73
- loadingText?: string;
74
- showLoading?: boolean;
75
- minimumDisplayTime?: number;
76
- onReady?: () => void | Promise<void>;
77
- renderLogo?: () => ReactNode;
78
- renderContent?: () => ReactNode;
79
- renderFooter?: () => ReactNode;
80
- }
81
- ```
82
-
83
- ## Architecture
84
-
85
- - **Domain Layer**: Entities and interfaces (business logic)
86
- - **Presentation Layer**: Components (UI)
87
-
88
- No app-specific code, fully generic and reusable.
89
-
90
- ## License
91
-
92
- MIT
93
-