@umituz/react-native-onboarding 3.3.6 → 3.3.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 +4 -4
- package/src/presentation/components/BackgroundVideo.tsx +33 -0
- package/src/presentation/components/OnboardingFooter.tsx +16 -16
- package/src/presentation/components/OnboardingHeader.tsx +3 -3
- package/src/presentation/components/OnboardingScreenContent.tsx +5 -19
- package/src/presentation/components/OnboardingSlide.tsx +1 -1
- package/src/presentation/styles/OnboardingSlideStyles.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-onboarding",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.8",
|
|
4
4
|
"description": "Advanced onboarding flow for React Native apps with personalization questions, theme-aware colors, animations, and customizable slides. SOLID, DRY, KISS principles applied.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@umituz/react-native-localization": "latest",
|
|
37
37
|
"@umituz/react-native-design-system": "latest",
|
|
38
38
|
"@expo/vector-icons": ">=14.0.0",
|
|
39
|
-
"expo-av": ">=15.0.0",
|
|
40
39
|
"expo-image": ">=2.0.0",
|
|
41
40
|
"expo-linear-gradient": ">=13.0.0",
|
|
41
|
+
"expo-video": ">=1.0.0",
|
|
42
42
|
"react": ">=18.2.0",
|
|
43
43
|
"react-native": ">=0.74.0",
|
|
44
44
|
"react-native-safe-area-context": ">=4.0.0",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@umituz/react-native-localization": "latest",
|
|
51
51
|
"@umituz/react-native-design-system": "latest",
|
|
52
52
|
"@expo/vector-icons": "^14.0.0",
|
|
53
|
-
"expo-av": "~15.0.0",
|
|
54
53
|
"expo-image": "~2.0.0",
|
|
55
54
|
"expo-linear-gradient": "^15.0.7",
|
|
55
|
+
"expo-video": "~2.0.0",
|
|
56
56
|
"zustand": "^5.0.0",
|
|
57
57
|
"@types/react": "~19.1.10",
|
|
58
58
|
"react": "19.1.0",
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"README.md",
|
|
69
69
|
"LICENSE"
|
|
70
70
|
]
|
|
71
|
-
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { useVideoPlayer, VideoView } from 'expo-video';
|
|
4
|
+
|
|
5
|
+
interface BackgroundVideoProps {
|
|
6
|
+
source: any;
|
|
7
|
+
overlayOpacity?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const BackgroundVideo: React.FC<BackgroundVideoProps> = ({ source, overlayOpacity = 0.5 }) => {
|
|
11
|
+
const player = useVideoPlayer(source, player => {
|
|
12
|
+
player.loop = true;
|
|
13
|
+
player.play();
|
|
14
|
+
player.muted = true;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View style={StyleSheet.absoluteFill}>
|
|
19
|
+
<VideoView
|
|
20
|
+
player={player}
|
|
21
|
+
style={StyleSheet.absoluteFill}
|
|
22
|
+
contentFit="cover"
|
|
23
|
+
nativeControls={false}
|
|
24
|
+
/>
|
|
25
|
+
<View
|
|
26
|
+
style={[
|
|
27
|
+
StyleSheet.absoluteFill,
|
|
28
|
+
{ backgroundColor: `rgba(0,0,0,${overlayOpacity})` }
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -43,8 +43,8 @@ export const OnboardingFooter: React.FC<OnboardingFooterProps> = ({
|
|
|
43
43
|
const styles = useMemo(() => getStyles(insets, tokens, useGradient), [insets, tokens, useGradient]);
|
|
44
44
|
|
|
45
45
|
const buttonText = isLastSlide
|
|
46
|
-
? getStartedButtonText || t("onboarding.getStarted"
|
|
47
|
-
: nextButtonText || t("general.continue"
|
|
46
|
+
? getStartedButtonText || t("onboarding.getStarted")
|
|
47
|
+
: nextButtonText || t("general.continue");
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<View style={styles.footer}>
|
|
@@ -85,7 +85,7 @@ export const OnboardingFooter: React.FC<OnboardingFooterProps> = ({
|
|
|
85
85
|
|
|
86
86
|
{showProgressText && (
|
|
87
87
|
<Text style={styles.progressText}>
|
|
88
|
-
{currentIndex + 1} {t("general.of"
|
|
88
|
+
{currentIndex + 1} {t("general.of")} {totalSlides}
|
|
89
89
|
</Text>
|
|
90
90
|
)}
|
|
91
91
|
</View>
|
|
@@ -108,15 +108,15 @@ const getStyles = (
|
|
|
108
108
|
},
|
|
109
109
|
progressBar: {
|
|
110
110
|
height: 4,
|
|
111
|
-
backgroundColor: useGradient
|
|
112
|
-
? "rgba(255, 255, 255, 0.2)"
|
|
111
|
+
backgroundColor: useGradient
|
|
112
|
+
? "rgba(255, 255, 255, 0.2)"
|
|
113
113
|
: tokens.colors.borderLight,
|
|
114
114
|
borderRadius: 2,
|
|
115
115
|
overflow: "hidden",
|
|
116
116
|
},
|
|
117
117
|
progressFill: {
|
|
118
118
|
height: "100%",
|
|
119
|
-
backgroundColor: useGradient ?
|
|
119
|
+
backgroundColor: useGradient ? tokens.colors.surface : tokens.colors.primary,
|
|
120
120
|
borderRadius: 2,
|
|
121
121
|
},
|
|
122
122
|
dots: {
|
|
@@ -129,24 +129,24 @@ const getStyles = (
|
|
|
129
129
|
width: 6,
|
|
130
130
|
height: 6,
|
|
131
131
|
borderRadius: 3,
|
|
132
|
-
backgroundColor: useGradient
|
|
133
|
-
? "rgba(255, 255, 255, 0.4)"
|
|
132
|
+
backgroundColor: useGradient
|
|
133
|
+
? "rgba(255, 255, 255, 0.4)"
|
|
134
134
|
: tokens.colors.borderLight,
|
|
135
135
|
},
|
|
136
136
|
dotActive: {
|
|
137
137
|
width: 8,
|
|
138
|
-
backgroundColor: useGradient ?
|
|
138
|
+
backgroundColor: useGradient ? tokens.colors.surface : tokens.colors.primary,
|
|
139
139
|
},
|
|
140
140
|
button: {
|
|
141
|
-
backgroundColor: useGradient ?
|
|
141
|
+
backgroundColor: useGradient ? tokens.colors.surface : tokens.colors.primary,
|
|
142
142
|
paddingVertical: 16,
|
|
143
143
|
borderRadius: 28,
|
|
144
144
|
alignItems: "center",
|
|
145
145
|
marginBottom: 12,
|
|
146
146
|
},
|
|
147
147
|
buttonDisabled: {
|
|
148
|
-
backgroundColor: useGradient
|
|
149
|
-
? "rgba(255, 255, 255, 0.4)"
|
|
148
|
+
backgroundColor: useGradient
|
|
149
|
+
? "rgba(255, 255, 255, 0.4)"
|
|
150
150
|
: tokens.colors.borderLight,
|
|
151
151
|
opacity: 0.5,
|
|
152
152
|
},
|
|
@@ -156,13 +156,13 @@ const getStyles = (
|
|
|
156
156
|
fontWeight: "bold",
|
|
157
157
|
},
|
|
158
158
|
buttonTextDisabled: {
|
|
159
|
-
color: useGradient
|
|
160
|
-
? "rgba(255, 255, 255, 0.6)"
|
|
159
|
+
color: useGradient
|
|
160
|
+
? "rgba(255, 255, 255, 0.6)"
|
|
161
161
|
: tokens.colors.textSecondary,
|
|
162
162
|
},
|
|
163
163
|
progressText: {
|
|
164
|
-
color: useGradient
|
|
165
|
-
? "rgba(255, 255, 255, 0.75)"
|
|
164
|
+
color: useGradient
|
|
165
|
+
? "rgba(255, 255, 255, 0.75)"
|
|
166
166
|
: tokens.colors.textSecondary,
|
|
167
167
|
fontSize: 12,
|
|
168
168
|
textAlign: "center",
|
|
@@ -33,7 +33,7 @@ export const OnboardingHeader: React.FC<OnboardingHeaderProps> = ({
|
|
|
33
33
|
const tokens = useAppDesignTokens();
|
|
34
34
|
const styles = useMemo(() => getStyles(tokens, useGradient), [tokens, useGradient]);
|
|
35
35
|
|
|
36
|
-
const skipText = skipButtonText || t("onboarding.skip"
|
|
36
|
+
const skipText = skipButtonText || t("onboarding.skip");
|
|
37
37
|
|
|
38
38
|
const handleBackPress = () => {
|
|
39
39
|
/* eslint-disable-next-line no-console */
|
|
@@ -61,7 +61,7 @@ export const OnboardingHeader: React.FC<OnboardingHeaderProps> = ({
|
|
|
61
61
|
<AtomicIcon
|
|
62
62
|
name="chevron-back"
|
|
63
63
|
customSize={20}
|
|
64
|
-
customColor={useGradient ?
|
|
64
|
+
customColor={useGradient ? tokens.colors.surface : tokens.colors.textPrimary}
|
|
65
65
|
/>
|
|
66
66
|
</TouchableOpacity>
|
|
67
67
|
) : (
|
|
@@ -107,7 +107,7 @@ const getStyles = (
|
|
|
107
107
|
opacity: 0.3,
|
|
108
108
|
},
|
|
109
109
|
skipText: {
|
|
110
|
-
color: useGradient ?
|
|
110
|
+
color: useGradient ? tokens.colors.surface : tokens.colors.textPrimary,
|
|
111
111
|
fontSize: 16,
|
|
112
112
|
fontWeight: "600",
|
|
113
113
|
},
|
|
@@ -7,13 +7,13 @@ import React from "react";
|
|
|
7
7
|
import { View, StyleSheet, StatusBar } from "react-native";
|
|
8
8
|
import { LinearGradient } from "expo-linear-gradient";
|
|
9
9
|
import { Image } from "expo-image";
|
|
10
|
-
import { Video, ResizeMode } from "expo-av";
|
|
11
10
|
import { useTheme } from "@umituz/react-native-design-system";
|
|
12
11
|
import type { OnboardingSlide } from "../../domain/entities/OnboardingSlide";
|
|
13
12
|
import { OnboardingHeader } from "./OnboardingHeader";
|
|
14
13
|
import { OnboardingSlide as OnboardingSlideComponent } from "./OnboardingSlide";
|
|
15
14
|
import { QuestionSlide } from "./QuestionSlide";
|
|
16
15
|
import { OnboardingFooter } from "./OnboardingFooter";
|
|
16
|
+
import { BackgroundVideo } from "./BackgroundVideo";
|
|
17
17
|
|
|
18
18
|
export interface OnboardingScreenContentProps {
|
|
19
19
|
containerStyle?: any;
|
|
@@ -97,22 +97,10 @@ export const OnboardingScreenContent: React.FC<OnboardingScreenContentProps> = (
|
|
|
97
97
|
|
|
98
98
|
if (currentSlide.backgroundVideo) {
|
|
99
99
|
return (
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
resizeMode={ResizeMode.COVER}
|
|
105
|
-
isLooping
|
|
106
|
-
shouldPlay
|
|
107
|
-
isMuted
|
|
108
|
-
/>
|
|
109
|
-
<View
|
|
110
|
-
style={[
|
|
111
|
-
StyleSheet.absoluteFill,
|
|
112
|
-
{ backgroundColor: `rgba(0,0,0,${overlayOpacity})` }
|
|
113
|
-
]}
|
|
114
|
-
/>
|
|
115
|
-
</View>
|
|
100
|
+
<BackgroundVideo
|
|
101
|
+
source={currentSlide.backgroundVideo}
|
|
102
|
+
overlayOpacity={overlayOpacity}
|
|
103
|
+
/>
|
|
116
104
|
);
|
|
117
105
|
}
|
|
118
106
|
|
|
@@ -223,5 +211,3 @@ const styles = StyleSheet.create({
|
|
|
223
211
|
flex: 1,
|
|
224
212
|
},
|
|
225
213
|
});
|
|
226
|
-
|
|
227
|
-
|
|
@@ -36,7 +36,7 @@ export const OnboardingSlide: React.FC<OnboardingSlideProps> = ({
|
|
|
36
36
|
// Simple check for valid icon name - assuming string and not emoji
|
|
37
37
|
const isValidIconName = !isEmoji && typeof slide.icon === "string" && slide.icon.length > 0;
|
|
38
38
|
|
|
39
|
-
const iconColor = useGradient ?
|
|
39
|
+
const iconColor = useGradient ? tokens.colors.surface : tokens.colors.primary;
|
|
40
40
|
const iconSize = variant === "minimal" ? 80 : 64;
|
|
41
41
|
|
|
42
42
|
const renderIcon = () => {
|
|
@@ -79,11 +79,6 @@ export const createOnboardingStyles = (
|
|
|
79
79
|
alignItems: "center",
|
|
80
80
|
// Shadow only for non-gradient or light mode
|
|
81
81
|
...(!useGradient && {
|
|
82
|
-
shadowColor: tokens.colors.shadow,
|
|
83
|
-
shadowOffset: { width: 0, height: 4 },
|
|
84
|
-
shadowOpacity: 0.1,
|
|
85
|
-
shadowRadius: 12,
|
|
86
|
-
elevation: 5,
|
|
87
82
|
borderWidth: 1,
|
|
88
83
|
borderColor: tokens.colors.borderLight,
|
|
89
84
|
}),
|