@umituz/react-native-onboarding 2.7.1 → 2.7.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.7.
|
|
3
|
+
"version": "2.7.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",
|
|
@@ -36,7 +36,11 @@ export const OnboardingHeader: React.FC<OnboardingHeaderProps> = ({
|
|
|
36
36
|
const skipText = skipButtonText || t("onboarding.skip", "Skip");
|
|
37
37
|
|
|
38
38
|
const handleBackPress = () => {
|
|
39
|
-
|
|
39
|
+
/* eslint-disable-next-line no-console */
|
|
40
|
+
if (__DEV__) {
|
|
41
|
+
console.log("[OnboardingHeader] Back pressed, isFirstSlide:", isFirstSlide);
|
|
42
|
+
}
|
|
43
|
+
if (!isFirstSlide && onBack) {
|
|
40
44
|
onBack();
|
|
41
45
|
}
|
|
42
46
|
};
|
|
@@ -52,10 +56,11 @@ export const OnboardingHeader: React.FC<OnboardingHeaderProps> = ({
|
|
|
52
56
|
isFirstSlide && styles.headerButtonDisabled,
|
|
53
57
|
]}
|
|
54
58
|
activeOpacity={0.7}
|
|
59
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
55
60
|
>
|
|
56
61
|
<ArrowLeft
|
|
57
62
|
size={20}
|
|
58
|
-
color
|
|
63
|
+
{...({ color: useGradient ? "#FFFFFF" : tokens.colors.textPrimary } as any)}
|
|
59
64
|
/>
|
|
60
65
|
</TouchableOpacity>
|
|
61
66
|
) : (
|
|
@@ -38,24 +38,57 @@ export const SliderQuestion: React.FC<SliderQuestionProps> = ({
|
|
|
38
38
|
SliderComponent,
|
|
39
39
|
}) => {
|
|
40
40
|
const { min, max } = useMemo(() => getSliderConfig(question), [question]);
|
|
41
|
-
const currentValue = value ?? min;
|
|
41
|
+
const currentValue = value ?? question.defaultValue ?? min;
|
|
42
|
+
const [sliderError, setSliderError] = React.useState<string | null>(null);
|
|
43
|
+
|
|
44
|
+
// Render slider with error boundary
|
|
45
|
+
const renderSlider = () => {
|
|
46
|
+
if (!SliderComponent) {
|
|
47
|
+
return (
|
|
48
|
+
<View style={styles.errorContainer}>
|
|
49
|
+
<Text style={styles.errorText}>
|
|
50
|
+
Slider component is not available. Please provide SliderComponent prop.
|
|
51
|
+
</Text>
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
return (
|
|
58
|
+
<SliderComponent
|
|
59
|
+
style={styles.slider}
|
|
60
|
+
minimumValue={min}
|
|
61
|
+
maximumValue={max}
|
|
62
|
+
value={currentValue}
|
|
63
|
+
onValueChange={onChange}
|
|
64
|
+
minimumTrackTintColor="#FFFFFF"
|
|
65
|
+
maximumTrackTintColor="rgba(255, 255, 255, 0.3)"
|
|
66
|
+
thumbTintColor="#FFFFFF"
|
|
67
|
+
step={1}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
/* eslint-disable-next-line no-console */
|
|
72
|
+
if (__DEV__) {
|
|
73
|
+
console.error("[SliderQuestion] Error rendering slider:", error);
|
|
74
|
+
}
|
|
75
|
+
setSliderError("Unable to render slider. Native module may not be linked.");
|
|
76
|
+
return (
|
|
77
|
+
<View style={styles.errorContainer}>
|
|
78
|
+
<Text style={styles.errorText}>
|
|
79
|
+
Unable to render slider. Please ensure @react-native-community/slider is properly installed and linked.
|
|
80
|
+
</Text>
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
42
85
|
|
|
43
86
|
return (
|
|
44
87
|
<View style={styles.container}>
|
|
45
88
|
<View style={styles.valueContainer}>
|
|
46
89
|
<Text style={styles.valueText}>{currentValue}</Text>
|
|
47
90
|
</View>
|
|
48
|
-
|
|
49
|
-
style={styles.slider}
|
|
50
|
-
minimumValue={min}
|
|
51
|
-
maximumValue={max}
|
|
52
|
-
value={currentValue}
|
|
53
|
-
onValueChange={onChange}
|
|
54
|
-
minimumTrackTintColor="#FFFFFF"
|
|
55
|
-
maximumTrackTintColor="rgba(255, 255, 255, 0.3)"
|
|
56
|
-
thumbTintColor="#FFFFFF"
|
|
57
|
-
step={1}
|
|
58
|
-
/>
|
|
91
|
+
{renderSlider()}
|
|
59
92
|
<View style={styles.labels}>
|
|
60
93
|
<Text style={styles.label}>{min}</Text>
|
|
61
94
|
<Text style={styles.label}>{max}</Text>
|
|
@@ -92,4 +125,14 @@ const styles = StyleSheet.create({
|
|
|
92
125
|
color: "rgba(255, 255, 255, 0.7)",
|
|
93
126
|
fontWeight: "500",
|
|
94
127
|
},
|
|
128
|
+
errorContainer: {
|
|
129
|
+
padding: 20,
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
marginVertical: 16,
|
|
132
|
+
},
|
|
133
|
+
errorText: {
|
|
134
|
+
color: "#FFFFFF",
|
|
135
|
+
textAlign: "center",
|
|
136
|
+
fontSize: 14,
|
|
137
|
+
},
|
|
95
138
|
});
|