@umituz/react-native-onboarding 2.6.2 → 2.6.3
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-onboarding",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
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",
|
|
@@ -85,5 +85,11 @@ export interface OnboardingOptions {
|
|
|
85
85
|
* Show paywall modal on onboarding completion (default: false)
|
|
86
86
|
*/
|
|
87
87
|
showPaywallOnComplete?: boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Use gradient background for all slides (default: false)
|
|
91
|
+
* When true, all slides will use gradient backgrounds if available
|
|
92
|
+
*/
|
|
93
|
+
useGradient?: boolean;
|
|
88
94
|
}
|
|
89
95
|
|
|
@@ -10,13 +10,23 @@ import type { OnboardingSlide } from "../../domain/entities/OnboardingSlide";
|
|
|
10
10
|
/**
|
|
11
11
|
* Check if slide should use gradient background
|
|
12
12
|
* @param slide - The slide to check
|
|
13
|
+
* @param globalUseGradient - Global useGradient option from OnboardingOptions
|
|
13
14
|
* @returns true if gradient should be used, false otherwise
|
|
14
15
|
*/
|
|
15
|
-
export function shouldUseGradient(
|
|
16
|
+
export function shouldUseGradient(
|
|
17
|
+
slide: OnboardingSlide | undefined,
|
|
18
|
+
globalUseGradient?: boolean
|
|
19
|
+
): boolean {
|
|
16
20
|
if (!slide) {
|
|
17
21
|
return false;
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
// If global useGradient is true, use gradient if slide has gradient defined
|
|
25
|
+
if (globalUseGradient === true) {
|
|
26
|
+
return slide.gradient !== undefined && slide.gradient.length > 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Otherwise, check slide's own useGradient prop
|
|
20
30
|
return (
|
|
21
31
|
slide.useGradient === true &&
|
|
22
32
|
slide.gradient !== undefined &&
|
|
@@ -88,6 +88,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
|
|
|
88
88
|
renderSlide,
|
|
89
89
|
onUpgrade,
|
|
90
90
|
showPaywallOnComplete = false,
|
|
91
|
+
useGradient: globalUseGradient = false,
|
|
91
92
|
}) => {
|
|
92
93
|
const insets = useSafeAreaInsets();
|
|
93
94
|
const tokens = useAppDesignTokens();
|
|
@@ -175,7 +176,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
|
|
|
175
176
|
};
|
|
176
177
|
|
|
177
178
|
// Check if gradient should be used
|
|
178
|
-
const useGradient = shouldUseGradient(currentSlide);
|
|
179
|
+
const useGradient = shouldUseGradient(currentSlide, globalUseGradient);
|
|
179
180
|
|
|
180
181
|
// Validate answer using service
|
|
181
182
|
const isAnswerValid = useMemo(() => {
|