@umituz/react-native-auth 3.4.31 → 3.4.32
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 +1 -1
- package/src/presentation/README.md +2 -2
- package/src/presentation/components/LoginForm.md +158 -267
- package/src/presentation/components/PasswordIndicators.md +199 -410
- package/src/presentation/components/ProfileComponents.md +254 -111
- package/src/presentation/components/SocialLoginButtons.md +295 -258
- package/src/presentation/hooks/useAccountManagement.md +191 -185
- package/src/presentation/hooks/useAuthBottomSheet.md +74 -77
- package/src/presentation/hooks/useSocialLogin.md +90 -145
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Profile Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Components for user profile display and account management.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Components
|
|
6
6
|
|
|
7
|
-
- **[`ProfileSection`](#profilesection)** -
|
|
8
|
-
- **[`AccountActions`](#accountactions)** -
|
|
7
|
+
- **[`ProfileSection`](#profilesection)** - Profile display section
|
|
8
|
+
- **[`AccountActions`](#accountactions)** - Account management actions
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
## ProfileSection
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Component that displays user profile information including avatar, name, and user ID.
|
|
15
15
|
|
|
16
|
-
###
|
|
16
|
+
### Usage
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
import { ProfileSection } from '@umituz/react-native-auth';
|
|
@@ -37,8 +37,8 @@ function SettingsScreen() {
|
|
|
37
37
|
}}
|
|
38
38
|
onPress={() => navigation.navigate('EditProfile')}
|
|
39
39
|
onSignIn={() => navigation.navigate('Login')}
|
|
40
|
-
signInText="
|
|
41
|
-
anonymousText="
|
|
40
|
+
signInText="Sign In"
|
|
41
|
+
anonymousText="Guest"
|
|
42
42
|
/>
|
|
43
43
|
</View>
|
|
44
44
|
);
|
|
@@ -47,30 +47,30 @@ function SettingsScreen() {
|
|
|
47
47
|
|
|
48
48
|
### Props
|
|
49
49
|
|
|
50
|
-
| Prop |
|
|
51
|
-
|
|
52
|
-
| `profile` | `ProfileSectionConfig` | Yes |
|
|
53
|
-
| `onPress` | `() => void` | No | Press handler (authenticated
|
|
54
|
-
| `onSignIn` | `() => void` | No | Sign-in handler (anonymous
|
|
55
|
-
| `signInText` | `string` | No | "
|
|
56
|
-
| `anonymousText` | `string` | No | Anonymous
|
|
50
|
+
| Prop | Type | Required | Description |
|
|
51
|
+
|------|------|----------|-------------|
|
|
52
|
+
| `profile` | `ProfileSectionConfig` | Yes | Profile configuration |
|
|
53
|
+
| `onPress` | `() => void` | No | Press handler (for authenticated users) |
|
|
54
|
+
| `onSignIn` | `() => void` | No | Sign-in handler (for anonymous users) |
|
|
55
|
+
| `signInText` | `string` | No | "Sign In" button text |
|
|
56
|
+
| `anonymousText` | `string` | No | Anonymous user label |
|
|
57
57
|
|
|
58
58
|
#### ProfileSectionConfig
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
interface ProfileSectionConfig {
|
|
62
|
-
displayName?: string; //
|
|
63
|
-
userId?: string; //
|
|
64
|
-
isAnonymous: boolean; //
|
|
65
|
-
avatarUrl?: string; //
|
|
66
|
-
accountSettingsRoute?: string; //
|
|
67
|
-
benefits?: string[]; //
|
|
62
|
+
displayName?: string; // Display name
|
|
63
|
+
userId?: string; // User ID
|
|
64
|
+
isAnonymous: boolean; // Is anonymous user
|
|
65
|
+
avatarUrl?: string; // Profile photo URL
|
|
66
|
+
accountSettingsRoute?: string; // Account settings route
|
|
67
|
+
benefits?: string[]; // Benefits list
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### Examples
|
|
72
72
|
|
|
73
|
-
#### Authenticated
|
|
73
|
+
#### Authenticated User
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
76
|
function ProfileSection() {
|
|
@@ -95,14 +95,14 @@ function ProfileSection() {
|
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
#### Anonymous
|
|
98
|
+
#### Anonymous User
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
101
|
function ProfileSection() {
|
|
102
102
|
const { user } = useAuth();
|
|
103
103
|
|
|
104
104
|
const profile = {
|
|
105
|
-
displayName: '
|
|
105
|
+
displayName: 'Guest User',
|
|
106
106
|
userId: undefined,
|
|
107
107
|
isAnonymous: true,
|
|
108
108
|
avatarUrl: undefined,
|
|
@@ -114,13 +114,13 @@ function ProfileSection() {
|
|
|
114
114
|
<ProfileSection
|
|
115
115
|
profile={profile}
|
|
116
116
|
onSignIn={() => navigation.navigate('Login')}
|
|
117
|
-
signInText="
|
|
117
|
+
signInText="Sign In"
|
|
118
118
|
/>
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
#### Benefits
|
|
123
|
+
#### With Benefits
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
126
|
function PremiumProfileSection() {
|
|
@@ -132,9 +132,9 @@ function PremiumProfileSection() {
|
|
|
132
132
|
isAnonymous: false,
|
|
133
133
|
avatarUrl: user?.photoURL,
|
|
134
134
|
benefits: [
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'
|
|
135
|
+
'Access to premium content',
|
|
136
|
+
'Ad-free experience',
|
|
137
|
+
'Exclusive discounts',
|
|
138
138
|
],
|
|
139
139
|
};
|
|
140
140
|
|
|
@@ -166,8 +166,8 @@ function DynamicProfileSection() {
|
|
|
166
166
|
isAnonymous: profile?.isAnonymous || false,
|
|
167
167
|
avatarUrl: profile?.avatarUrl,
|
|
168
168
|
benefits: profile?.isAnonymous
|
|
169
|
-
? ['
|
|
170
|
-
: ['
|
|
169
|
+
? ['Create an account to access more features']
|
|
170
|
+
: ['Get premium membership', 'Access exclusive content'],
|
|
171
171
|
}}
|
|
172
172
|
onPress={handlePress}
|
|
173
173
|
/>
|
|
@@ -175,13 +175,67 @@ function DynamicProfileSection() {
|
|
|
175
175
|
}
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
#### With Custom Avatar
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
function ProfileSectionWithCustomAvatar() {
|
|
182
|
+
const { user } = useAuth();
|
|
183
|
+
const navigation = useNavigation();
|
|
184
|
+
|
|
185
|
+
const profile = {
|
|
186
|
+
displayName: user?.displayName || 'User',
|
|
187
|
+
userId: user?.uid,
|
|
188
|
+
isAnonymous: user?.isAnonymous || false,
|
|
189
|
+
avatarUrl: user?.photoURL || 'https://example.com/default-avatar.png',
|
|
190
|
+
accountSettingsRoute: 'AccountSettings',
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<ProfileSection
|
|
195
|
+
profile={profile}
|
|
196
|
+
onPress={() => navigation.navigate('EditProfile')}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### With Edit Indicator
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
function ProfileSectionWithEditIndicator() {
|
|
206
|
+
const profile = useUserProfile();
|
|
207
|
+
const navigation = useNavigation();
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<View>
|
|
211
|
+
<ProfileSection
|
|
212
|
+
profile={{
|
|
213
|
+
displayName: profile?.displayName,
|
|
214
|
+
userId: profile?.userId,
|
|
215
|
+
isAnonymous: profile?.isAnonymous || false,
|
|
216
|
+
avatarUrl: profile?.avatarUrl,
|
|
217
|
+
accountSettingsRoute: 'AccountSettings',
|
|
218
|
+
}}
|
|
219
|
+
onPress={() => navigation.navigate('EditProfile')}
|
|
220
|
+
/>
|
|
221
|
+
<TouchableOpacity
|
|
222
|
+
style={styles.editButton}
|
|
223
|
+
onPress={() => navigation.navigate('EditProfile')}
|
|
224
|
+
>
|
|
225
|
+
<Text>Edit Profile</Text>
|
|
226
|
+
</TouchableOpacity>
|
|
227
|
+
</View>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
178
232
|
---
|
|
179
233
|
|
|
180
234
|
## AccountActions
|
|
181
235
|
|
|
182
|
-
|
|
236
|
+
Component for account management operations including sign out, password change, and account deletion.
|
|
183
237
|
|
|
184
|
-
###
|
|
238
|
+
### Usage
|
|
185
239
|
|
|
186
240
|
```typescript
|
|
187
241
|
import { AccountActions } from '@umituz/react-native-auth';
|
|
@@ -191,15 +245,15 @@ function AccountSettingsScreen() {
|
|
|
191
245
|
const navigation = useNavigation();
|
|
192
246
|
|
|
193
247
|
const config = {
|
|
194
|
-
logoutText: '
|
|
195
|
-
deleteAccountText: '
|
|
196
|
-
changePasswordText: '
|
|
197
|
-
logoutConfirmTitle: '
|
|
198
|
-
logoutConfirmMessage: '
|
|
199
|
-
deleteConfirmTitle: '
|
|
200
|
-
deleteConfirmMessage: '
|
|
201
|
-
deleteErrorTitle: '
|
|
202
|
-
deleteErrorMessage: '
|
|
248
|
+
logoutText: 'Sign Out',
|
|
249
|
+
deleteAccountText: 'Delete Account',
|
|
250
|
+
changePasswordText: 'Change Password',
|
|
251
|
+
logoutConfirmTitle: 'Sign Out',
|
|
252
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
253
|
+
deleteConfirmTitle: 'Delete Account',
|
|
254
|
+
deleteConfirmMessage: 'This action cannot be undone. Continue?',
|
|
255
|
+
deleteErrorTitle: 'Error',
|
|
256
|
+
deleteErrorMessage: 'Account could not be deleted. Please try again.',
|
|
203
257
|
onLogout: async () => {
|
|
204
258
|
await logout();
|
|
205
259
|
navigation.replace('Login');
|
|
@@ -224,45 +278,45 @@ function AccountSettingsScreen() {
|
|
|
224
278
|
|
|
225
279
|
### Props
|
|
226
280
|
|
|
227
|
-
| Prop |
|
|
228
|
-
|
|
229
|
-
| `config` | `AccountActionsConfig` | Yes |
|
|
281
|
+
| Prop | Type | Required | Description |
|
|
282
|
+
|------|------|----------|-------------|
|
|
283
|
+
| `config` | `AccountActionsConfig` | Yes | Account actions configuration |
|
|
230
284
|
|
|
231
285
|
#### AccountActionsConfig
|
|
232
286
|
|
|
233
287
|
```typescript
|
|
234
288
|
interface AccountActionsConfig {
|
|
235
|
-
logoutText: string; // "
|
|
236
|
-
deleteAccountText: string; // "
|
|
237
|
-
changePasswordText?: string; // "
|
|
238
|
-
logoutConfirmTitle: string; //
|
|
239
|
-
logoutConfirmMessage: string; //
|
|
240
|
-
deleteConfirmTitle: string; //
|
|
241
|
-
deleteConfirmMessage: string; //
|
|
242
|
-
deleteErrorTitle?: string; //
|
|
243
|
-
deleteErrorMessage?: string; //
|
|
244
|
-
onLogout: () => Promise<void>; //
|
|
245
|
-
onDeleteAccount: () => Promise<void>; //
|
|
246
|
-
onChangePassword?: () => void; //
|
|
247
|
-
showChangePassword?: boolean; //
|
|
289
|
+
logoutText: string; // "Sign Out" button text
|
|
290
|
+
deleteAccountText: string; // "Delete Account" button text
|
|
291
|
+
changePasswordText?: string; // "Change Password" button text
|
|
292
|
+
logoutConfirmTitle: string; // Sign out confirmation title
|
|
293
|
+
logoutConfirmMessage: string; // Sign out confirmation message
|
|
294
|
+
deleteConfirmTitle: string; // Delete confirmation title
|
|
295
|
+
deleteConfirmMessage: string; // Delete confirmation message
|
|
296
|
+
deleteErrorTitle?: string; // Delete error title
|
|
297
|
+
deleteErrorMessage?: string; // Delete error message
|
|
298
|
+
onLogout: () => Promise<void>; // Sign out handler
|
|
299
|
+
onDeleteAccount: () => Promise<void>; // Delete handler
|
|
300
|
+
onChangePassword?: () => void; // Change password handler
|
|
301
|
+
showChangePassword?: boolean; // Show change password button
|
|
248
302
|
}
|
|
249
303
|
```
|
|
250
304
|
|
|
251
|
-
###
|
|
305
|
+
### Examples
|
|
252
306
|
|
|
253
|
-
####
|
|
307
|
+
#### Basic Usage
|
|
254
308
|
|
|
255
309
|
```typescript
|
|
256
310
|
function SimpleAccountActions() {
|
|
257
311
|
const { logout, deleteAccount } = useAccountManagement();
|
|
258
312
|
|
|
259
313
|
const config = {
|
|
260
|
-
logoutText: '
|
|
261
|
-
deleteAccountText: '
|
|
262
|
-
logoutConfirmTitle: '
|
|
263
|
-
logoutConfirmMessage: '
|
|
264
|
-
deleteConfirmTitle: '
|
|
265
|
-
deleteConfirmMessage: '
|
|
314
|
+
logoutText: 'Sign Out',
|
|
315
|
+
deleteAccountText: 'Delete Account',
|
|
316
|
+
logoutConfirmTitle: 'Sign Out',
|
|
317
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
318
|
+
deleteConfirmTitle: 'Delete Account',
|
|
319
|
+
deleteConfirmMessage: 'Are you sure you want to delete your account?',
|
|
266
320
|
onLogout: logout,
|
|
267
321
|
onDeleteAccount: deleteAccount,
|
|
268
322
|
};
|
|
@@ -271,7 +325,7 @@ function SimpleAccountActions() {
|
|
|
271
325
|
}
|
|
272
326
|
```
|
|
273
327
|
|
|
274
|
-
####
|
|
328
|
+
#### With Password Change
|
|
275
329
|
|
|
276
330
|
```typescript
|
|
277
331
|
function AccountActionsWithPasswordChange() {
|
|
@@ -279,13 +333,13 @@ function AccountActionsWithPasswordChange() {
|
|
|
279
333
|
const navigation = useNavigation();
|
|
280
334
|
|
|
281
335
|
const config = {
|
|
282
|
-
logoutText: '
|
|
283
|
-
deleteAccountText: '
|
|
284
|
-
changePasswordText: '
|
|
285
|
-
logoutConfirmTitle: '
|
|
286
|
-
logoutConfirmMessage: '
|
|
287
|
-
deleteConfirmTitle: '
|
|
288
|
-
deleteConfirmMessage: '
|
|
336
|
+
logoutText: 'Sign Out',
|
|
337
|
+
deleteAccountText: 'Delete Account',
|
|
338
|
+
changePasswordText: 'Change Password',
|
|
339
|
+
logoutConfirmTitle: 'Sign Out',
|
|
340
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
341
|
+
deleteConfirmTitle: 'Delete Account',
|
|
342
|
+
deleteConfirmMessage: 'Are you sure you want to delete your account?',
|
|
289
343
|
onLogout: async () => {
|
|
290
344
|
await logout();
|
|
291
345
|
navigation.replace('Login');
|
|
@@ -304,7 +358,7 @@ function AccountActionsWithPasswordChange() {
|
|
|
304
358
|
}
|
|
305
359
|
```
|
|
306
360
|
|
|
307
|
-
#### Custom Error Handling
|
|
361
|
+
#### With Custom Error Handling
|
|
308
362
|
|
|
309
363
|
```typescript
|
|
310
364
|
function AccountActionsWithErrorHandling() {
|
|
@@ -312,29 +366,29 @@ function AccountActionsWithErrorHandling() {
|
|
|
312
366
|
const navigation = useNavigation();
|
|
313
367
|
|
|
314
368
|
const config = {
|
|
315
|
-
logoutText: '
|
|
316
|
-
deleteAccountText: '
|
|
317
|
-
logoutConfirmTitle: '
|
|
318
|
-
logoutConfirmMessage: '
|
|
319
|
-
deleteConfirmTitle: '
|
|
320
|
-
deleteConfirmMessage: '
|
|
321
|
-
deleteErrorTitle: '
|
|
322
|
-
deleteErrorMessage: '
|
|
369
|
+
logoutText: 'Sign Out',
|
|
370
|
+
deleteAccountText: 'Delete Account',
|
|
371
|
+
logoutConfirmTitle: 'Sign Out',
|
|
372
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
373
|
+
deleteConfirmTitle: 'Delete Account',
|
|
374
|
+
deleteConfirmMessage: 'This action cannot be undone. Continue?',
|
|
375
|
+
deleteErrorTitle: 'Account Deletion Failed',
|
|
376
|
+
deleteErrorMessage: 'An error occurred while deleting your account. Please try again later or contact support.',
|
|
323
377
|
onLogout: async () => {
|
|
324
378
|
try {
|
|
325
379
|
await logout();
|
|
326
380
|
navigation.replace('Login');
|
|
327
381
|
} catch (error) {
|
|
328
|
-
Alert.alert('
|
|
382
|
+
Alert.alert('Error', 'Failed to sign out');
|
|
329
383
|
}
|
|
330
384
|
},
|
|
331
385
|
onDeleteAccount: async () => {
|
|
332
386
|
try {
|
|
333
387
|
await deleteAccount();
|
|
334
|
-
Alert.alert('
|
|
388
|
+
Alert.alert('Success', 'Your account has been deleted');
|
|
335
389
|
navigation.replace('Login');
|
|
336
390
|
} catch (error) {
|
|
337
|
-
//
|
|
391
|
+
// Error is automatically shown (deleteErrorMessage)
|
|
338
392
|
throw error;
|
|
339
393
|
}
|
|
340
394
|
},
|
|
@@ -344,7 +398,7 @@ function AccountActionsWithErrorHandling() {
|
|
|
344
398
|
}
|
|
345
399
|
```
|
|
346
400
|
|
|
347
|
-
#### Anonymous
|
|
401
|
+
#### For Anonymous Users
|
|
348
402
|
|
|
349
403
|
```typescript
|
|
350
404
|
function AccountActionsAnonymous() {
|
|
@@ -353,18 +407,18 @@ function AccountActionsAnonymous() {
|
|
|
353
407
|
if (isAnonymous) {
|
|
354
408
|
return (
|
|
355
409
|
<Button onPress={() => navigation.navigate('Register')}>
|
|
356
|
-
|
|
410
|
+
Create Account
|
|
357
411
|
</Button>
|
|
358
412
|
);
|
|
359
413
|
}
|
|
360
414
|
|
|
361
415
|
const config = {
|
|
362
|
-
logoutText: '
|
|
363
|
-
deleteAccountText: '
|
|
364
|
-
logoutConfirmTitle: '
|
|
365
|
-
logoutConfirmMessage: '
|
|
366
|
-
deleteConfirmTitle: '
|
|
367
|
-
deleteConfirmMessage: '
|
|
416
|
+
logoutText: 'Sign Out',
|
|
417
|
+
deleteAccountText: 'Delete Account',
|
|
418
|
+
logoutConfirmTitle: 'Sign Out',
|
|
419
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
420
|
+
deleteConfirmTitle: 'Delete Account',
|
|
421
|
+
deleteConfirmMessage: 'Are you sure you want to delete your account?',
|
|
368
422
|
onLogout: logout,
|
|
369
423
|
onDeleteAccount: deleteAccount,
|
|
370
424
|
};
|
|
@@ -373,7 +427,70 @@ function AccountActionsAnonymous() {
|
|
|
373
427
|
}
|
|
374
428
|
```
|
|
375
429
|
|
|
376
|
-
|
|
430
|
+
#### With Loading States
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
function AccountActionsWithLoading() {
|
|
434
|
+
const { logout, deleteAccount, isLoading, isDeletingAccount } = useAccountManagement();
|
|
435
|
+
const navigation = useNavigation();
|
|
436
|
+
|
|
437
|
+
const config = {
|
|
438
|
+
logoutText: isLoading ? 'Signing out...' : 'Sign Out',
|
|
439
|
+
deleteAccountText: isDeletingAccount ? 'Deleting...' : 'Delete Account',
|
|
440
|
+
logoutConfirmTitle: 'Sign Out',
|
|
441
|
+
logoutConfirmMessage: 'Are you sure?',
|
|
442
|
+
deleteConfirmTitle: 'Delete Account',
|
|
443
|
+
deleteConfirmMessage: 'This cannot be undone. Continue?',
|
|
444
|
+
onLogout: async () => {
|
|
445
|
+
await logout();
|
|
446
|
+
navigation.replace('Login');
|
|
447
|
+
},
|
|
448
|
+
onDeleteAccount: async () => {
|
|
449
|
+
await deleteAccount();
|
|
450
|
+
navigation.replace('Login');
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
return (
|
|
455
|
+
<AccountActions
|
|
456
|
+
config={config}
|
|
457
|
+
isLoading={isLoading}
|
|
458
|
+
isDeletingAccount={isDeletingAccount}
|
|
459
|
+
/>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
#### With Analytics
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
function AccountActionsWithAnalytics() {
|
|
468
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
469
|
+
const analytics = useAnalytics();
|
|
470
|
+
|
|
471
|
+
const config = {
|
|
472
|
+
logoutText: 'Sign Out',
|
|
473
|
+
deleteAccountText: 'Delete Account',
|
|
474
|
+
logoutConfirmTitle: 'Sign Out',
|
|
475
|
+
logoutConfirmMessage: 'Are you sure?',
|
|
476
|
+
deleteConfirmTitle: 'Delete Account',
|
|
477
|
+
deleteConfirmMessage: 'This cannot be undone.',
|
|
478
|
+
onLogout: async () => {
|
|
479
|
+
analytics.trackEvent('account_logout');
|
|
480
|
+
await logout();
|
|
481
|
+
},
|
|
482
|
+
onDeleteAccount: async () => {
|
|
483
|
+
analytics.trackEvent('account_delete_initiated');
|
|
484
|
+
await deleteAccount();
|
|
485
|
+
analytics.trackEvent('account_delete_completed');
|
|
486
|
+
},
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
return <AccountActions config={config} />;
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## Combined Usage
|
|
377
494
|
|
|
378
495
|
```typescript
|
|
379
496
|
function AccountSettingsScreen() {
|
|
@@ -383,7 +500,7 @@ function AccountSettingsScreen() {
|
|
|
383
500
|
|
|
384
501
|
return (
|
|
385
502
|
<ScrollView>
|
|
386
|
-
{/*
|
|
503
|
+
{/* Profile section */}
|
|
387
504
|
<ProfileSection
|
|
388
505
|
profile={{
|
|
389
506
|
displayName: profile?.displayName,
|
|
@@ -394,16 +511,16 @@ function AccountSettingsScreen() {
|
|
|
394
511
|
onPress={() => navigation.navigate('EditProfile')}
|
|
395
512
|
/>
|
|
396
513
|
|
|
397
|
-
{/*
|
|
514
|
+
{/* Account actions */}
|
|
398
515
|
{!profile?.isAnonymous && (
|
|
399
516
|
<AccountActions
|
|
400
517
|
config={{
|
|
401
|
-
logoutText: '
|
|
402
|
-
deleteAccountText: '
|
|
403
|
-
logoutConfirmTitle: '
|
|
404
|
-
logoutConfirmMessage: '
|
|
405
|
-
deleteConfirmTitle: '
|
|
406
|
-
deleteConfirmMessage: '
|
|
518
|
+
logoutText: 'Sign Out',
|
|
519
|
+
deleteAccountText: 'Delete Account',
|
|
520
|
+
logoutConfirmTitle: 'Sign Out',
|
|
521
|
+
logoutConfirmMessage: 'Are you sure you want to sign out?',
|
|
522
|
+
deleteConfirmTitle: 'Delete Account',
|
|
523
|
+
deleteConfirmMessage: 'This action cannot be undone. Continue?',
|
|
407
524
|
onLogout: async () => {
|
|
408
525
|
await logout();
|
|
409
526
|
navigation.replace('Login');
|
|
@@ -420,13 +537,39 @@ function AccountSettingsScreen() {
|
|
|
420
537
|
}
|
|
421
538
|
```
|
|
422
539
|
|
|
423
|
-
##
|
|
540
|
+
## Styling
|
|
541
|
+
|
|
542
|
+
Components use design system tokens:
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
{
|
|
546
|
+
colors: {
|
|
547
|
+
primary: tokens.colors.primary,
|
|
548
|
+
danger: tokens.colors.error,
|
|
549
|
+
text: tokens.colors.textPrimary,
|
|
550
|
+
background: tokens.colors.background,
|
|
551
|
+
},
|
|
552
|
+
spacing: tokens.spacing,
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
## Accessibility
|
|
557
|
+
|
|
558
|
+
Components include accessibility features:
|
|
559
|
+
|
|
560
|
+
- ✅ Screen reader labels
|
|
561
|
+
- ✅ Accessibility hints
|
|
562
|
+
- ✅ Proper touch targets
|
|
563
|
+
- ✅ High contrast support
|
|
564
|
+
- ✅ Semantic button labels
|
|
565
|
+
|
|
566
|
+
## Related Components
|
|
424
567
|
|
|
425
|
-
- [`EditProfileForm`](./
|
|
426
|
-
- [`EditProfileAvatar`](./
|
|
568
|
+
- [`EditProfileForm`](./README.md) - Profile editing form
|
|
569
|
+
- [`EditProfileAvatar`](./README.md) - Profile photo editing
|
|
427
570
|
|
|
428
|
-
##
|
|
571
|
+
## Related Hooks
|
|
429
572
|
|
|
430
|
-
- [`useUserProfile`](../hooks/useUserProfile.md) -
|
|
431
|
-
- [`useAccountManagement`](../hooks/useAccountManagement.md) -
|
|
432
|
-
- [`useAuth`](../hooks/useAuth.md) -
|
|
573
|
+
- [`useUserProfile`](../hooks/useUserProfile.md) - Profile data hook
|
|
574
|
+
- [`useAccountManagement`](../hooks/useAccountManagement.md) - Account management hook
|
|
575
|
+
- [`useAuth`](../hooks/useAuth.md) - Main auth state management
|