@umituz/react-native-splash 2.0.0 → 2.1.1

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": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Ultra minimal splash screen for React Native apps. Just icon, name, and tagline.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -22,6 +22,7 @@
22
22
  "url": "https://github.com/umituz/react-native-splash"
23
23
  },
24
24
  "peerDependencies": {
25
+ "expo-linear-gradient": ">=14.0.0",
25
26
  "react": ">=18.2.0",
26
27
  "react-native": ">=0.74.0",
27
28
  "react-native-safe-area-context": ">=4.0.0"
@@ -43,4 +44,4 @@
43
44
  "README.md",
44
45
  "LICENSE"
45
46
  ]
46
- }
47
+ }
@@ -17,6 +17,9 @@ export interface SplashOptions {
17
17
  /** Background color (default: #6366F1) */
18
18
  backgroundColor?: string;
19
19
 
20
+ /** Gradient colors - if provided, overrides backgroundColor */
21
+ gradientColors?: readonly [string, string, ...string[]];
22
+
20
23
  /** Text color (default: #FFFFFF) */
21
24
  textColor?: string;
22
25
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from "react";
9
9
  import { View, Text, Image, StyleSheet, ActivityIndicator } from "react-native";
10
+ import { LinearGradient } from "expo-linear-gradient";
10
11
  import { useSafeAreaInsets } from "react-native-safe-area-context";
11
12
  import type { SplashOptions } from "../../domain/entities/SplashOptions";
12
13
 
@@ -23,39 +24,67 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
23
24
  appName = "",
24
25
  tagline = "",
25
26
  backgroundColor = DEFAULT_BG,
27
+ gradientColors,
26
28
  textColor = DEFAULT_TEXT,
27
29
  showLoading = true,
28
30
  visible = true,
29
31
  }) => {
30
32
  const insets = useSafeAreaInsets();
31
33
 
32
- if (!visible) return null;
34
+ React.useEffect(() => {
35
+ if (__DEV__) {
36
+ console.log(`[SplashScreen] Mounted - appName: ${appName}, visible: ${visible}`);
37
+ }
38
+ }, [appName, visible]);
33
39
 
34
- return (
35
- <View style={[styles.container, { backgroundColor }]}>
36
- <View style={[styles.content, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
37
- <View style={styles.center}>
38
- {icon ? (
39
- <Image source={icon} style={styles.icon} resizeMode="contain" />
40
- ) : (
41
- <View style={styles.iconPlaceholder} />
42
- )}
40
+ if (!visible) {
41
+ if (__DEV__) console.log('[SplashScreen] Not visible, returning null');
42
+ return null;
43
+ }
43
44
 
44
- {appName ? (
45
- <Text style={[styles.title, { color: textColor }]}>{appName}</Text>
46
- ) : null}
45
+ const content = (
46
+ <View style={[styles.content, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>
47
+ <View style={styles.center}>
48
+ {icon ? (
49
+ <Image source={icon} style={styles.icon} resizeMode="contain" />
50
+ ) : (
51
+ <View style={styles.iconPlaceholder} />
52
+ )}
47
53
 
48
- {tagline ? (
49
- <Text style={[styles.subtitle, { color: textColor }]}>{tagline}</Text>
50
- ) : null}
51
- </View>
54
+ {appName ? (
55
+ <Text style={[styles.title, { color: textColor }]}>{appName}</Text>
56
+ ) : null}
52
57
 
53
- {showLoading ? (
54
- <View style={styles.loading}>
55
- <ActivityIndicator color={textColor} size="small" />
56
- </View>
58
+ {tagline ? (
59
+ <Text style={[styles.subtitle, { color: textColor }]}>{tagline}</Text>
57
60
  ) : null}
58
61
  </View>
62
+
63
+ {showLoading ? (
64
+ <View style={styles.loading}>
65
+ <ActivityIndicator color={textColor} size="small" />
66
+ </View>
67
+ ) : null}
68
+ </View>
69
+ );
70
+
71
+ // Use gradient if colors provided, otherwise solid background
72
+ if (gradientColors && gradientColors.length >= 2) {
73
+ return (
74
+ <LinearGradient
75
+ colors={gradientColors as [string, string, ...string[]]}
76
+ style={styles.container}
77
+ start={{ x: 0, y: 0 }}
78
+ end={{ x: 0, y: 1 }}
79
+ >
80
+ {content}
81
+ </LinearGradient>
82
+ );
83
+ }
84
+
85
+ return (
86
+ <View style={[styles.container, { backgroundColor }]}>
87
+ {content}
59
88
  </View>
60
89
  );
61
90
  };