@umituz/react-native-settings 4.17.2 → 4.17.4

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.17.2",
3
+ "version": "4.17.4",
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",
@@ -32,6 +32,7 @@
32
32
  "@react-navigation/stack": ">=6.0.0",
33
33
  "@umituz/react-native-about": "latest",
34
34
  "@umituz/react-native-appearance": "latest",
35
+ "@umituz/react-native-auth": "latest",
35
36
  "@umituz/react-native-avatar": "latest",
36
37
  "@umituz/react-native-faqs": "latest",
37
38
  "@umituz/react-native-feedback": "latest",
@@ -54,6 +55,7 @@
54
55
  "@types/react": "~19.1.10",
55
56
  "@umituz/react-native-about": "latest",
56
57
  "@umituz/react-native-appearance": "latest",
58
+ "@umituz/react-native-auth": "latest",
57
59
  "@umituz/react-native-avatar": "latest",
58
60
  "@umituz/react-native-faqs": "latest",
59
61
  "@umituz/react-native-feedback": "latest",
@@ -75,4 +77,4 @@
75
77
  "README.md",
76
78
  "LICENSE"
77
79
  ]
78
- }
80
+ }
package/src/index.ts CHANGED
@@ -69,9 +69,6 @@ export type { SettingsSectionProps } from './presentation/components/SettingsSec
69
69
  export { SettingsFooter } from './presentation/components/SettingsFooter';
70
70
  export type { SettingsFooterProps } from './presentation/components/SettingsFooter';
71
71
 
72
- export { UserProfileHeader } from './presentation/components/UserProfileHeader';
73
- export type { UserProfileHeaderProps } from './presentation/components/UserProfileHeader';
74
-
75
72
  export { SettingsErrorBoundary } from './presentation/components/SettingsErrorBoundary';
76
73
 
77
74
  export { CloudSyncSetting } from './presentation/components/CloudSyncSetting';
@@ -9,7 +9,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
9
9
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { useLocalization } from "@umituz/react-native-localization";
11
11
  import { SettingsFooter } from "../../components/SettingsFooter";
12
- import { UserProfileHeader } from "../../components/UserProfileHeader";
12
+ import { ProfileSection } from "@umituz/react-native-auth";
13
13
  import { SettingsSection } from "../../components/SettingsSection";
14
14
  import { DevSettingsSection, DevSettingsProps } from "../../components/DevSettingsSection";
15
15
  import { NotificationsSection } from "@umituz/react-native-notifications";
@@ -144,19 +144,18 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
144
144
  ]}
145
145
  showsVerticalScrollIndicator={false}
146
146
  >
147
- {showUserProfile && (
147
+ {showUserProfile && userProfile && (
148
148
  <View style={styles.profileContainer}>
149
- <UserProfileHeader
150
- displayName={userProfile?.displayName}
151
- userId={userProfile?.userId}
152
- isAnonymous={userProfile?.isAnonymous}
153
- avatarUrl={userProfile?.avatarUrl}
154
- accountSettingsRoute={userProfile?.accountSettingsRoute}
155
- onPress={userProfile?.onPress}
156
- anonymousDisplayName={userProfile?.anonymousDisplayName}
157
- avatarServiceUrl={userProfile?.avatarServiceUrl}
158
- defaultUserDisplayName={t("settings.profile.defaultUserName")}
159
- defaultAnonymousDisplayName={t("settings.profile.anonymousName")}
149
+ <ProfileSection
150
+ profile={{
151
+ displayName: userProfile.displayName || (userProfile.isAnonymous ? t("settings.profile.anonymousName") : t("settings.profile.defaultUserName")),
152
+ userId: userProfile.userId,
153
+ isAnonymous: userProfile.isAnonymous || false,
154
+ avatarUrl: userProfile.avatarUrl,
155
+ accountSettingsRoute: userProfile.accountSettingsRoute,
156
+ }}
157
+ onPress={userProfile.onPress}
158
+ onSignIn={userProfile.onPress}
160
159
  />
161
160
  </View>
162
161
  )}
@@ -1,166 +0,0 @@
1
- /**
2
- * User Profile Header Component
3
- * Displays user avatar, name, and ID
4
- * Works for both guest and authenticated users
5
- */
6
-
7
- import React, { useCallback } from "react";
8
- import { View, TouchableOpacity, StyleSheet } from "react-native";
9
- import {
10
- AtomicIcon,
11
- AtomicText,
12
- useAppDesignTokens,
13
- } from "@umituz/react-native-design-system";
14
- import { useNavigation } from "@react-navigation/native";
15
- import { Avatar } from "@umituz/react-native-avatar";
16
-
17
- export interface UserProfileHeaderProps {
18
- /** User display name */
19
- displayName?: string;
20
- /** User ID */
21
- userId?: string;
22
- /** Whether user is anonymous (device-based ID) */
23
- isAnonymous?: boolean;
24
- /** Avatar URL (optional) */
25
- avatarUrl?: string;
26
- /** Navigation route for account settings */
27
- accountSettingsRoute?: string;
28
- /** Custom onPress handler */
29
- onPress?: () => void;
30
- /** Custom anonymous user display name */
31
- anonymousDisplayName?: string;
32
- /** Custom avatar service URL */
33
- avatarServiceUrl?: string;
34
- /** Default user display name when no displayName provided */
35
- defaultUserDisplayName?: string;
36
- /** Default anonymous display name */
37
- defaultAnonymousDisplayName?: string;
38
- }
39
-
40
- export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
41
- displayName,
42
- userId,
43
- isAnonymous = false,
44
- avatarUrl,
45
- accountSettingsRoute,
46
- onPress,
47
- anonymousDisplayName,
48
- avatarServiceUrl,
49
- defaultUserDisplayName,
50
- defaultAnonymousDisplayName,
51
- }) => {
52
- const tokens = useAppDesignTokens();
53
- const navigation = useNavigation();
54
- const colors = tokens.colors;
55
- const spacing = tokens.spacing;
56
- const finalDisplayName = displayName || (isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : defaultUserDisplayName || "User");
57
- const avatarName = isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : finalDisplayName;
58
-
59
- const handlePress = useCallback(() => {
60
- if (onPress) {
61
- onPress();
62
- } else if (accountSettingsRoute) {
63
- navigation.navigate(accountSettingsRoute as never);
64
- }
65
- }, [onPress, accountSettingsRoute, navigation]);
66
-
67
- const shouldShowChevron = !!(onPress || accountSettingsRoute);
68
- const isPressable = !!(onPress || accountSettingsRoute);
69
-
70
- const containerStyle = [
71
- styles.container,
72
- {
73
- backgroundColor: colors.surface,
74
- paddingHorizontal: spacing.md,
75
- paddingVertical: spacing.md,
76
- marginHorizontal: spacing.md,
77
- },
78
- ];
79
-
80
- const content = (
81
- <>
82
- <View style={styles.content}>
83
- <View style={styles.avatarContainer}>
84
- <Avatar
85
- uri={avatarUrl}
86
- name={avatarName}
87
- size="lg"
88
- shape="circle"
89
- />
90
- </View>
91
- <View style={[styles.textContainer, { marginLeft: spacing.md }]}>
92
- <AtomicText
93
- type="headlineSmall"
94
- style={[styles.name, { color: colors.textPrimary }]}
95
- numberOfLines={1}
96
- >
97
- {finalDisplayName}
98
- </AtomicText>
99
- {userId && (
100
- <AtomicText
101
- type="bodySmall"
102
- style={[styles.id, { color: colors.textSecondary }]}
103
- numberOfLines={1}
104
- >
105
- {userId}
106
- </AtomicText>
107
- )}
108
- </View>
109
- </View>
110
- <View style={[styles.chevronContainer, { marginLeft: spacing.sm }]}>
111
- <AtomicIcon name="chevron-forward" size="md" color="onSurface" />
112
- </View>
113
- </>
114
- );
115
-
116
- if (isPressable) {
117
- return (
118
- <TouchableOpacity
119
- style={containerStyle}
120
- onPress={handlePress}
121
- activeOpacity={0.7}
122
- >
123
- {content}
124
- </TouchableOpacity>
125
- );
126
- }
127
-
128
- return <View style={containerStyle}>{content}</View>;
129
- };
130
-
131
- const styles = StyleSheet.create({
132
- container: {
133
- flexDirection: "row",
134
- alignItems: "center",
135
- justifyContent: "space-between",
136
- marginTop: 0,
137
- marginBottom: 0,
138
- borderRadius: 20,
139
- minHeight: 80,
140
- },
141
- content: {
142
- flexDirection: "row",
143
- alignItems: "center",
144
- flex: 1,
145
- },
146
- avatarContainer: {
147
- justifyContent: "center",
148
- alignItems: "center",
149
- },
150
- textContainer: {
151
- flex: 1,
152
- },
153
- name: {
154
- fontWeight: "700",
155
- },
156
- id: {
157
- fontWeight: "500",
158
- opacity: 0.7,
159
- },
160
- chevronContainer: {
161
- justifyContent: "center",
162
- alignItems: "center",
163
- },
164
- });
165
-
166
-