@umituz/react-native-onboarding 3.1.1 → 3.2.0
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": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -91,3 +91,7 @@ export type { TextInputQuestionProps } from "./presentation/components/questions
|
|
|
91
91
|
export { RatingQuestion } from "./presentation/components/questions/RatingQuestion";
|
|
92
92
|
export type { RatingQuestionProps } from "./presentation/components/questions/RatingQuestion";
|
|
93
93
|
|
|
94
|
+
export { OnboardingResetSetting } from "./presentation/components/OnboardingResetSetting";
|
|
95
|
+
export type { OnboardingResetSettingProps } from "./presentation/components/OnboardingResetSetting";
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onboarding Reset Setting Component
|
|
3
|
+
* Single Responsibility: Provide onboarding reset functionality for settings screens
|
|
4
|
+
* Generic component for hundreds of apps
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { useCallback } from "react";
|
|
8
|
+
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
9
|
+
import { AtomicIcon } from "@umituz/react-native-design-system-atoms";
|
|
10
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
11
|
+
|
|
12
|
+
export interface OnboardingResetSettingProps {
|
|
13
|
+
/** Callback when reset is triggered */
|
|
14
|
+
onReset: () => void | Promise<void>;
|
|
15
|
+
/** Custom icon name */
|
|
16
|
+
iconName?: string;
|
|
17
|
+
/** Custom icon color */
|
|
18
|
+
iconColor?: string;
|
|
19
|
+
/** Custom title color */
|
|
20
|
+
titleColor?: string;
|
|
21
|
+
/** Whether to show this setting (default: only in __DEV__) */
|
|
22
|
+
visible?: boolean;
|
|
23
|
+
/** Is last item in list */
|
|
24
|
+
isLast?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const OnboardingResetSetting: React.FC<OnboardingResetSettingProps> = ({
|
|
28
|
+
onReset,
|
|
29
|
+
iconName = "refresh-outline",
|
|
30
|
+
iconColor,
|
|
31
|
+
titleColor,
|
|
32
|
+
visible = __DEV__,
|
|
33
|
+
isLast = false,
|
|
34
|
+
}) => {
|
|
35
|
+
const tokens = useAppDesignTokens();
|
|
36
|
+
|
|
37
|
+
const handlePress = useCallback(async () => {
|
|
38
|
+
await onReset();
|
|
39
|
+
}, [onReset]);
|
|
40
|
+
|
|
41
|
+
if (!visible) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const defaultIconColor = iconColor || tokens.colors.warning;
|
|
46
|
+
const defaultTitleColor = titleColor || tokens.colors.warning;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<TouchableOpacity onPress={handlePress} activeOpacity={0.7}>
|
|
50
|
+
<View style={[styles.container, !isLast && { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: tokens.colors.border }]}>
|
|
51
|
+
<View style={styles.iconContainer}>
|
|
52
|
+
<AtomicIcon
|
|
53
|
+
name={iconName}
|
|
54
|
+
size="md"
|
|
55
|
+
customColor={defaultIconColor}
|
|
56
|
+
/>
|
|
57
|
+
</View>
|
|
58
|
+
<View style={styles.content}>
|
|
59
|
+
<Text
|
|
60
|
+
style={[styles.title, { color: defaultTitleColor }]}
|
|
61
|
+
numberOfLines={1}
|
|
62
|
+
>
|
|
63
|
+
onboarding_reset_title
|
|
64
|
+
</Text>
|
|
65
|
+
<Text
|
|
66
|
+
style={[styles.description, { color: tokens.colors.textSecondary }]}
|
|
67
|
+
numberOfLines={1}
|
|
68
|
+
>
|
|
69
|
+
onboarding_reset_description
|
|
70
|
+
</Text>
|
|
71
|
+
</View>
|
|
72
|
+
</View>
|
|
73
|
+
</TouchableOpacity>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const styles = StyleSheet.create({
|
|
78
|
+
container: {
|
|
79
|
+
flexDirection: "row",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
paddingVertical: 12,
|
|
82
|
+
paddingHorizontal: 16,
|
|
83
|
+
},
|
|
84
|
+
iconContainer: {
|
|
85
|
+
marginRight: 12,
|
|
86
|
+
},
|
|
87
|
+
content: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
fontSize: 16,
|
|
92
|
+
fontWeight: "500",
|
|
93
|
+
},
|
|
94
|
+
description: {
|
|
95
|
+
fontSize: 14,
|
|
96
|
+
marginTop: 2,
|
|
97
|
+
},
|
|
98
|
+
});
|