@umituz/react-native-onboarding 3.6.24 → 3.6.26
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 +1 -1
- package/src/domain/entities/OnboardingOptions.ts +3 -3
- package/src/domain/entities/OnboardingSlide.ts +1 -1
- package/src/index.ts +2 -2
- package/src/presentation/components/OnboardingScreenContent.tsx +5 -5
- package/src/presentation/hooks/__tests__/useOnboardingContainerStyle.test.ts +6 -6
- package/src/presentation/providers/OnboardingProvider.tsx +4 -4
- package/src/presentation/screens/OnboardingScreen.tsx +5 -5
- package/src/presentation/types/OnboardingProps.ts +1 -1
- package/src/presentation/types/OnboardingTheme.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-onboarding",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.26",
|
|
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",
|
|
@@ -87,10 +87,10 @@ export interface OnboardingOptions {
|
|
|
87
87
|
showPaywallOnComplete?: boolean;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Use
|
|
91
|
-
* When true, all slides will use
|
|
90
|
+
* Use custom background for all slides (default: false)
|
|
91
|
+
* When true, all slides will use custom backgrounds if available
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
useCustomBackground?: boolean;
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Visual theme variant (default: "default")
|
|
@@ -127,7 +127,7 @@ export interface OnboardingSlide {
|
|
|
127
127
|
backgroundVideo?: any;
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* Opacity of the overlay
|
|
130
|
+
* Opacity of the overlay color on top of background media
|
|
131
131
|
* Range: 0.0 to 1.0 (Default: 0.5)
|
|
132
132
|
*/
|
|
133
133
|
overlayOpacity?: number;
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React Native Onboarding - Public API
|
|
3
3
|
*
|
|
4
|
-
* Generic onboarding flow for React Native apps with
|
|
4
|
+
* Generic onboarding flow for React Native apps with custom backgrounds,
|
|
5
5
|
* animations, and customizable slides. Follows SOLID, DRY, KISS principles.
|
|
6
6
|
*
|
|
7
7
|
* Architecture:
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* title: 'Welcome',
|
|
20
20
|
* description: 'Welcome to the app',
|
|
21
21
|
* icon: '🎉',
|
|
22
|
-
*
|
|
22
|
+
* backgroundColor: '#3B82F6',
|
|
23
23
|
* },
|
|
24
24
|
* ]}
|
|
25
25
|
* onComplete={() => console.log('Completed')}
|
|
@@ -16,7 +16,7 @@ import type { OnboardingScreenContentProps } from "../types/OnboardingProps";
|
|
|
16
16
|
|
|
17
17
|
export const OnboardingScreenContent = ({
|
|
18
18
|
containerStyle,
|
|
19
|
-
|
|
19
|
+
useCustomBackground,
|
|
20
20
|
currentSlide,
|
|
21
21
|
isFirstSlide,
|
|
22
22
|
isLastSlide,
|
|
@@ -57,7 +57,7 @@ export const OnboardingScreenContent = ({
|
|
|
57
57
|
!!currentSlide?.backgroundVideo ||
|
|
58
58
|
(!!currentSlide?.backgroundImages && currentSlide.backgroundImages.length > 0);
|
|
59
59
|
const overlayOpacity = currentSlide?.overlayOpacity ?? 0.5;
|
|
60
|
-
const
|
|
60
|
+
const showOverlay = useCustomBackground || hasMedia;
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
63
|
<View
|
|
@@ -66,7 +66,7 @@ export const OnboardingScreenContent = ({
|
|
|
66
66
|
>
|
|
67
67
|
<StatusBar
|
|
68
68
|
barStyle={
|
|
69
|
-
themeMode === "dark" ||
|
|
69
|
+
themeMode === "dark" || showOverlay
|
|
70
70
|
? "light-content"
|
|
71
71
|
: "dark-content"
|
|
72
72
|
}
|
|
@@ -74,8 +74,8 @@ export const OnboardingScreenContent = ({
|
|
|
74
74
|
|
|
75
75
|
<OnboardingBackground
|
|
76
76
|
currentSlide={currentSlide}
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
useCustomBackground={useCustomBackground}
|
|
78
|
+
showOverlay={showOverlay}
|
|
79
79
|
overlayOpacity={overlayOpacity}
|
|
80
80
|
/>
|
|
81
81
|
|
|
@@ -39,9 +39,9 @@ describe('useOnboardingContainerStyle', () => {
|
|
|
39
39
|
} as any);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it('should return container style with
|
|
42
|
+
it('should return container style with custom background disabled', () => {
|
|
43
43
|
const { result } = renderHook(() =>
|
|
44
|
-
useOnboardingContainerStyle({
|
|
44
|
+
useOnboardingContainerStyle({ useCustomBackground: false })
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
expect(result.current.containerStyle).toEqual([
|
|
@@ -52,9 +52,9 @@ describe('useOnboardingContainerStyle', () => {
|
|
|
52
52
|
]);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
it('should return container style with
|
|
55
|
+
it('should return container style with custom background enabled', () => {
|
|
56
56
|
const { result } = renderHook(() =>
|
|
57
|
-
useOnboardingContainerStyle({
|
|
57
|
+
useOnboardingContainerStyle({ useCustomBackground: true })
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
expect(result.current.containerStyle).toEqual([
|
|
@@ -74,7 +74,7 @@ describe('useOnboardingContainerStyle', () => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
const { result } = renderHook(() =>
|
|
77
|
-
useOnboardingContainerStyle({
|
|
77
|
+
useOnboardingContainerStyle({ useCustomBackground: false })
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
expect(result.current.containerStyle[0].paddingTop).toBe(50);
|
|
@@ -88,7 +88,7 @@ describe('useOnboardingContainerStyle', () => {
|
|
|
88
88
|
} as any);
|
|
89
89
|
|
|
90
90
|
const { result } = renderHook(() =>
|
|
91
|
-
useOnboardingContainerStyle({
|
|
91
|
+
useOnboardingContainerStyle({ useCustomBackground: false })
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
expect(result.current.containerStyle[0].backgroundColor).toBe('#f0f0f0');
|
|
@@ -16,23 +16,23 @@ const OnboardingScope = createContext<OnboardingProviderValue | undefined>(undef
|
|
|
16
16
|
|
|
17
17
|
export interface OnboardingProviderProps {
|
|
18
18
|
children: React.ReactNode;
|
|
19
|
-
|
|
19
|
+
useCustomBackground: boolean;
|
|
20
20
|
colors: OnboardingColors;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const OnboardingProvider = ({
|
|
24
24
|
children,
|
|
25
|
-
|
|
25
|
+
useCustomBackground,
|
|
26
26
|
colors,
|
|
27
27
|
}: OnboardingProviderProps) => {
|
|
28
28
|
const value = useMemo(
|
|
29
29
|
() => ({
|
|
30
30
|
theme: {
|
|
31
31
|
colors,
|
|
32
|
-
|
|
32
|
+
useCustomBackground,
|
|
33
33
|
},
|
|
34
34
|
}),
|
|
35
|
-
[colors,
|
|
35
|
+
[colors, useCustomBackground]
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
return (
|
|
@@ -80,7 +80,7 @@ export const OnboardingScreen = ({
|
|
|
80
80
|
renderSlide,
|
|
81
81
|
onUpgrade,
|
|
82
82
|
showPaywallOnComplete = false,
|
|
83
|
-
|
|
83
|
+
useCustomBackground: globalUseCustomBackground = false,
|
|
84
84
|
themeVariant = "default",
|
|
85
85
|
themeColors: providedThemeColors,
|
|
86
86
|
}: OnboardingScreenProps) => {
|
|
@@ -121,7 +121,7 @@ export const OnboardingScreen = ({
|
|
|
121
121
|
isLastSlide,
|
|
122
122
|
currentAnswer,
|
|
123
123
|
isAnswerValid,
|
|
124
|
-
|
|
124
|
+
useCustomBackground,
|
|
125
125
|
containerStyle,
|
|
126
126
|
handleNext,
|
|
127
127
|
handlePrevious,
|
|
@@ -132,7 +132,7 @@ export const OnboardingScreen = ({
|
|
|
132
132
|
storageKey,
|
|
133
133
|
onComplete,
|
|
134
134
|
onSkip,
|
|
135
|
-
|
|
135
|
+
globalUseCustomBackground,
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
if (__DEV__) {
|
|
@@ -148,10 +148,10 @@ export const OnboardingScreen = ({
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
return (
|
|
151
|
-
<OnboardingProvider
|
|
151
|
+
<OnboardingProvider useCustomBackground={useCustomBackground} colors={themeColors}>
|
|
152
152
|
<OnboardingScreenContent
|
|
153
153
|
containerStyle={[styles.container, containerStyle]}
|
|
154
|
-
|
|
154
|
+
useCustomBackground={useCustomBackground}
|
|
155
155
|
currentSlide={currentSlide}
|
|
156
156
|
isFirstSlide={isFirstSlide}
|
|
157
157
|
isLastSlide={isLastSlide}
|
|
@@ -6,7 +6,7 @@ import type { OnboardingSlide } from "../../domain/entities/OnboardingSlide";
|
|
|
6
6
|
|
|
7
7
|
export interface OnboardingScreenContentProps {
|
|
8
8
|
containerStyle?: any;
|
|
9
|
-
|
|
9
|
+
useCustomBackground: boolean;
|
|
10
10
|
currentSlide: OnboardingSlide | undefined;
|
|
11
11
|
isFirstSlide: boolean;
|
|
12
12
|
isLastSlide: boolean;
|