@umituz/react-native-settings 4.16.4 → 4.16.5
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-settings",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.5",
|
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@react-navigation/native": ">=6.0.0",
|
|
31
31
|
"@react-navigation/stack": ">=6.0.0",
|
|
32
32
|
"@umituz/react-native-about": "^1.11.3",
|
|
33
|
+
"@umituz/react-native-avatar": "*",
|
|
33
34
|
"@umituz/react-native-appearance": "*",
|
|
34
35
|
"@umituz/react-native-design-system": "*",
|
|
35
36
|
"@umituz/react-native-design-system-atoms": "*",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"@umituz/react-native-about": "^1.11.4",
|
|
65
66
|
"@umituz/react-native-alert": "latest",
|
|
66
67
|
"@umituz/react-native-appearance": "^2.0.2",
|
|
68
|
+
"@umituz/react-native-avatar": "latest",
|
|
67
69
|
"@umituz/react-native-design-system": "latest",
|
|
68
70
|
"@umituz/react-native-design-system-atoms": "latest",
|
|
69
71
|
"@umituz/react-native-design-system-molecules": "latest",
|
|
@@ -38,11 +38,11 @@ const DEFAULT_TEXTS = {
|
|
|
38
38
|
export interface DevSettingsProps {
|
|
39
39
|
/** Enable dev settings section (default: true in __DEV__ mode) */
|
|
40
40
|
enabled?: boolean;
|
|
41
|
-
/** Callback after storage is cleared - use this to reload the app */
|
|
41
|
+
/** Callback after storage is cleared - use this to reload the app and reset app state (e.g., onboarding) */
|
|
42
42
|
onAfterClear?: () => Promise<void>;
|
|
43
43
|
/** Custom texts (optional - defaults to English) */
|
|
44
44
|
texts?: Partial<typeof DEFAULT_TEXTS>;
|
|
45
|
-
/** Custom dev components to render
|
|
45
|
+
/** Custom dev components to render BEFORE the "Clear All Data" button (e.g., OnboardingResetSetting) */
|
|
46
46
|
customDevComponents?: React.ReactNode[];
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Works for both guest and authenticated users
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React, {
|
|
8
|
-
import { View, TouchableOpacity, StyleSheet
|
|
7
|
+
import React, { useCallback } from "react";
|
|
8
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
9
9
|
import { Feather } from "@expo/vector-icons";
|
|
10
10
|
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
11
11
|
import { AtomicText } from "@umituz/react-native-design-system-atoms";
|
|
12
12
|
import { useNavigation } from "@react-navigation/native";
|
|
13
|
+
import { Avatar } from "@umituz/react-native-avatar";
|
|
13
14
|
|
|
14
15
|
export interface UserProfileHeaderProps {
|
|
15
16
|
/** User display name */
|
|
@@ -50,16 +51,9 @@ export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
|
|
|
50
51
|
const navigation = useNavigation();
|
|
51
52
|
const colors = tokens.colors;
|
|
52
53
|
const spacing = tokens.spacing;
|
|
53
|
-
const [imageError, setImageError] = useState(false);
|
|
54
|
-
|
|
55
54
|
const finalDisplayName = displayName || (isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : defaultUserDisplayName || "User");
|
|
56
55
|
const avatarName = isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : finalDisplayName;
|
|
57
56
|
|
|
58
|
-
const defaultAvatarService = avatarServiceUrl || "https://ui-avatars.com/api";
|
|
59
|
-
const finalAvatarUrl =
|
|
60
|
-
(imageError ? null : avatarUrl) ||
|
|
61
|
-
`${defaultAvatarService}/?name=${encodeURIComponent(avatarName)}&background=${colors.primary.replace("#", "")}&color=fff&size=64`;
|
|
62
|
-
|
|
63
57
|
const handlePress = useCallback(() => {
|
|
64
58
|
if (onPress) {
|
|
65
59
|
onPress();
|
|
@@ -84,24 +78,13 @@ export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
|
|
|
84
78
|
const content = (
|
|
85
79
|
<>
|
|
86
80
|
<View style={styles.content}>
|
|
87
|
-
<View style={
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
) : (
|
|
95
|
-
<View style={[styles.avatarFallback, { backgroundColor: `${colors.primary}20` }]}>
|
|
96
|
-
<AtomicText
|
|
97
|
-
type="headlineMedium"
|
|
98
|
-
color="primary"
|
|
99
|
-
style={styles.avatarText}
|
|
100
|
-
>
|
|
101
|
-
{avatarName.charAt(0).toUpperCase()}
|
|
102
|
-
</AtomicText>
|
|
103
|
-
</View>
|
|
104
|
-
)}
|
|
81
|
+
<View style={styles.avatarContainer}>
|
|
82
|
+
<Avatar
|
|
83
|
+
uri={avatarUrl}
|
|
84
|
+
name={avatarName}
|
|
85
|
+
size="lg"
|
|
86
|
+
shape="circle"
|
|
87
|
+
/>
|
|
105
88
|
</View>
|
|
106
89
|
<View style={[styles.textContainer, { marginLeft: spacing.md }]}>
|
|
107
90
|
<AtomicText
|
|
@@ -161,26 +144,9 @@ const styles = StyleSheet.create({
|
|
|
161
144
|
flex: 1,
|
|
162
145
|
},
|
|
163
146
|
avatarContainer: {
|
|
164
|
-
width: 64,
|
|
165
|
-
height: 64,
|
|
166
|
-
borderRadius: 32,
|
|
167
|
-
borderWidth: 2,
|
|
168
|
-
overflow: "hidden",
|
|
169
|
-
backgroundColor: "transparent",
|
|
170
|
-
},
|
|
171
|
-
avatar: {
|
|
172
|
-
width: "100%",
|
|
173
|
-
height: "100%",
|
|
174
|
-
},
|
|
175
|
-
avatarFallback: {
|
|
176
|
-
width: "100%",
|
|
177
|
-
height: "100%",
|
|
178
147
|
justifyContent: "center",
|
|
179
148
|
alignItems: "center",
|
|
180
149
|
},
|
|
181
|
-
avatarText: {
|
|
182
|
-
fontWeight: "700",
|
|
183
|
-
},
|
|
184
150
|
textContainer: {
|
|
185
151
|
flex: 1,
|
|
186
152
|
},
|