@umituz/react-native-splash 1.5.4 → 1.6.0

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-splash",
3
- "version": "1.5.4",
3
+ "version": "1.6.0",
4
4
  "description": "Generic splash screen for React Native apps with animations, gradients, and customizable branding. SOLID, DRY, KISS principles applied.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -27,10 +27,16 @@ export interface SplashOptions {
27
27
  logo?: ReactNode | string;
28
28
 
29
29
  /**
30
- * Background color
30
+ * Background color (will generate gradient automatically)
31
31
  */
32
32
  backgroundColor?: string;
33
33
 
34
+ /**
35
+ * Custom gradient colors (overrides backgroundColor)
36
+ * If provided, backgroundColor is ignored
37
+ */
38
+ gradientColors?: readonly string[];
39
+
34
40
  /**
35
41
  * Loading text
36
42
  */
@@ -16,10 +16,7 @@ import { SplashLogo } from "./SplashLogo";
16
16
  import { SplashTypography } from "./SplashTypography";
17
17
  import { SplashLoading } from "./SplashLoading";
18
18
  import { SplashDecorations } from "./SplashDecorations";
19
- import {
20
- getDefaultGradient,
21
- generateGradientFromColor,
22
- } from "../utils/splashGradient.utils";
19
+ import { generateGradientFromColor } from "../utils/splashGradient.utils";
23
20
  import type { SplashOptions } from "../../domain/entities/SplashOptions";
24
21
 
25
22
  export interface SplashScreenProps extends SplashOptions {
@@ -34,6 +31,7 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
34
31
  tagline,
35
32
  logo,
36
33
  backgroundColor,
34
+ gradientColors,
37
35
  loadingText,
38
36
  showLoading = true,
39
37
  minimumDisplayTime = 1500,
@@ -50,9 +48,14 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
50
48
 
51
49
  const isDark = themeMode === "dark";
52
50
 
53
- const gradientColors = backgroundColor
54
- ? generateGradientFromColor(backgroundColor, isDark)
55
- : getDefaultGradient(isDark);
51
+ // Use provided gradientColors, or generate from backgroundColor, or fallback to backgroundColor as single color
52
+ const finalGradientColors: readonly string[] =
53
+ gradientColors ||
54
+ (backgroundColor
55
+ ? generateGradientFromColor(backgroundColor, isDark)
56
+ : backgroundColor
57
+ ? [backgroundColor]
58
+ : [tokens.colors.primary]);
56
59
 
57
60
  const styles = getStyles(insets, tokens.spacing);
58
61
 
@@ -77,7 +80,7 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
77
80
  return (
78
81
  <View style={styles.container}>
79
82
  <LinearGradient
80
- colors={gradientColors as readonly string[]}
83
+ colors={finalGradientColors}
81
84
  start={{ x: 0, y: 0 }}
82
85
  end={{ x: 1, y: 1 }}
83
86
  style={styles.gradient}
@@ -25,15 +25,6 @@ export const adjustColorBrightness = (hex: string, percent: number): string => {
25
25
  );
26
26
  };
27
27
 
28
- /**
29
- * Get default gradient colors based on theme
30
- */
31
- export const getDefaultGradient = (isDark: boolean): readonly string[] => {
32
- return isDark
33
- ? (["#1E1B4B", "#312E81", "#4C1D95", "#6B21A8"] as const) // Dark indigo to purple
34
- : (["#6366F1", "#8B5CF6", "#A855F7", "#EC4899"] as const); // Indigo to pink
35
- };
36
-
37
28
  /**
38
29
  * Generate gradient colors from backgroundColor
39
30
  */