@umituz/react-native-settings 4.20.55 → 4.20.57

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.
Files changed (47) hide show
  1. package/README.md +145 -3
  2. package/package.json +1 -2
  3. package/src/application/README.md +322 -0
  4. package/src/domains/about/README.md +452 -0
  5. package/src/domains/about/presentation/hooks/README.md +350 -0
  6. package/src/domains/appearance/README.md +596 -0
  7. package/src/domains/appearance/hooks/README.md +366 -0
  8. package/src/domains/appearance/infrastructure/services/README.md +455 -0
  9. package/src/domains/cloud-sync/README.md +451 -0
  10. package/src/domains/cloud-sync/presentation/components/README.md +493 -0
  11. package/src/domains/dev/README.md +477 -0
  12. package/src/domains/disclaimer/README.md +421 -0
  13. package/src/domains/disclaimer/presentation/components/README.md +394 -0
  14. package/src/domains/faqs/README.md +586 -0
  15. package/src/domains/feedback/README.md +565 -0
  16. package/src/domains/feedback/presentation/hooks/README.md +428 -0
  17. package/src/domains/legal/README.md +549 -0
  18. package/src/domains/rating/README.md +452 -0
  19. package/src/domains/rating/presentation/components/README.md +475 -0
  20. package/src/domains/video-tutorials/README.md +482 -0
  21. package/src/domains/video-tutorials/presentation/components/README.md +433 -0
  22. package/src/infrastructure/README.md +509 -0
  23. package/src/infrastructure/repositories/README.md +475 -0
  24. package/src/infrastructure/services/README.md +510 -0
  25. package/src/presentation/components/README.md +482 -0
  26. package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
  27. package/src/presentation/components/SettingsFooter/README.md +446 -0
  28. package/src/presentation/components/SettingsItemCard/README.md +457 -0
  29. package/src/presentation/components/SettingsSection/README.md +421 -0
  30. package/src/presentation/hooks/README.md +413 -0
  31. package/src/presentation/hooks/mutations/README.md +430 -0
  32. package/src/presentation/hooks/queries/README.md +441 -0
  33. package/src/presentation/navigation/README.md +532 -0
  34. package/src/presentation/navigation/components/README.md +330 -0
  35. package/src/presentation/navigation/hooks/README.md +399 -0
  36. package/src/presentation/navigation/utils/README.md +442 -0
  37. package/src/presentation/screens/README.md +525 -0
  38. package/src/presentation/screens/components/SettingsContent/README.md +404 -0
  39. package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
  40. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
  41. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
  42. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
  43. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
  44. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
  45. package/src/presentation/screens/hooks/README.md +383 -0
  46. package/src/presentation/screens/types/README.md +439 -0
  47. package/src/presentation/screens/utils/README.md +288 -0
@@ -0,0 +1,532 @@
1
+ # Navigation System
2
+
3
+ Complete navigation setup for settings screens using React Navigation with stack navigator, screen wrappers, and navigation utilities.
4
+
5
+ ## Components
6
+
7
+ ### SettingsStackNavigator
8
+
9
+ Main stack navigator for all settings-related screens.
10
+
11
+ ```tsx
12
+ import { SettingsStackNavigator } from '@umituz/react-native-settings';
13
+
14
+ function App() {
15
+ const appInfo = {
16
+ name: 'My App',
17
+ version: '1.0.0',
18
+ // ... other app info
19
+ };
20
+
21
+ const legalUrls = {
22
+ privacyPolicy: 'https://example.com/privacy',
23
+ termsOfService: 'https://example.com/terms',
24
+ };
25
+
26
+ const faqData = {
27
+ categories: [
28
+ // FAQ categories
29
+ ],
30
+ };
31
+
32
+ return (
33
+ <NavigationContainer>
34
+ <SettingsStackNavigator
35
+ appInfo={appInfo}
36
+ legalUrls={legalUrls}
37
+ faqData={faqData}
38
+ />
39
+ </NavigationContainer>
40
+ );
41
+ }
42
+ ```
43
+
44
+ #### Props
45
+
46
+ | Prop | Type | Default | Description |
47
+ |------|------|---------|-------------|
48
+ | `appInfo` | `AppInfo` | **Required** | Application information |
49
+ | `legalUrls` | `LegalUrls` | **Required** | Legal document URLs |
50
+ | `faqData` | `FAQData` | `undefined` | FAQ data |
51
+ | `config` | `SettingsConfig` | `{}` | Settings configuration |
52
+ | `showUserProfile` | `boolean` | `false` | Show user profile header |
53
+ | `userProfile` | `UserProfile` | `undefined` | User profile data |
54
+ | `additionalScreens` | `Screen[]` | `[]` | Additional screens to add |
55
+ | `devSettings` | `DevSettingsProps` | `undefined` | Dev settings configuration |
56
+ | `customSections` | `CustomSection[]` | `[]` | Custom settings sections |
57
+
58
+ ### Screen Wrappers
59
+
60
+ Wrapper components that handle configuration and props for each screen.
61
+
62
+ #### SettingsScreenWrapper
63
+
64
+ Wraps the main settings screen with configuration.
65
+
66
+ ```tsx
67
+ import { SettingsScreenWrapper } from '@umituz/react-native-settings';
68
+
69
+ <SettingsScreenWrapper
70
+ config={config}
71
+ appVersion={appInfo.version}
72
+ showUserProfile={showUserProfile}
73
+ userProfile={userProfile}
74
+ devSettings={devSettings}
75
+ customSections={customSections}
76
+ />
77
+ ```
78
+
79
+ #### LegalScreenWrapper
80
+
81
+ Wraps the legal screen with proper handlers and translations.
82
+
83
+ ```tsx
84
+ import { LegalScreenWrapper } from '@umituz/react-native-settings';
85
+
86
+ <LegalScreenWrapper
87
+ onPrivacyPress={handlePrivacy}
88
+ onTermsPress={handleTerms}
89
+ onEulaPress={handleEula}
90
+ />
91
+ ```
92
+
93
+ #### AboutScreenWrapper
94
+
95
+ Wraps the about screen with app configuration.
96
+
97
+ ```tsx
98
+ import { AboutScreenWrapper } from '@umituz/react-native-settings';
99
+
100
+ <AboutScreenWrapper
101
+ config={aboutConfig}
102
+ />
103
+ ```
104
+
105
+ ## Navigation Hooks
106
+
107
+ ### useNavigationHandlers
108
+
109
+ Hook for managing navigation handlers and screen props.
110
+
111
+ ```tsx
112
+ import { useNavigationHandlers } from '@umituz/react-native-settings';
113
+
114
+ function NavigationSetup() {
115
+ const { handlePrivacyPress, handleTermsPress, handleEulaPress, aboutConfig } =
116
+ useNavigationHandlers(appInfo, legalUrls);
117
+
118
+ return (
119
+ <Stack.Navigator>
120
+ <Stack.Screen name="Legal">
121
+ {() => (
122
+ <LegalScreen
123
+ onPrivacyPress={handlePrivacyPress}
124
+ onTermsPress={handleTermsPress}
125
+ onEulaPress={handleEulaPress}
126
+ />
127
+ )}
128
+ </Stack.Screen>
129
+ <Stack.Screen name="About">
130
+ {() => <AboutScreen config={aboutConfig} />}
131
+ </Stack.Screen>
132
+ </Stack.Navigator>
133
+ );
134
+ }
135
+ ```
136
+
137
+ ## Navigation Utilities
138
+
139
+ ### Screen Options
140
+
141
+ Utility functions for creating screen options with translations.
142
+
143
+ ```tsx
144
+ import {
145
+ createScreenOptions,
146
+ createAppearanceScreenOptions,
147
+ createLegalScreenOptions,
148
+ createAboutScreenOptions,
149
+ createFAQScreenOptions,
150
+ } from '@umituz/react-native-settings';
151
+
152
+ // Create base screen options
153
+ const screenOptions = createScreenOptions(tokens);
154
+
155
+ // Create specific screen options
156
+ const appearanceOptions = createAppearanceScreenOptions(t);
157
+ const legalOptions = createLegalScreenOptions(t);
158
+ ```
159
+
160
+ ### Translation Utilities
161
+
162
+ ```tsx
163
+ import {
164
+ createNotificationTranslations,
165
+ createQuietHoursTranslations,
166
+ } from '@umituz/react-native-settings';
167
+
168
+ const notificationTranslations = createNotificationTranslations(t);
169
+ const quietHoursTranslations = createQuietHoursTranslations(t);
170
+ ```
171
+
172
+ ## Complete Examples
173
+
174
+ ### Basic Navigation Setup
175
+
176
+ ```tsx
177
+ import React from 'react';
178
+ import { NavigationContainer } from '@react-navigation/native';
179
+ import { SettingsStackNavigator } from '@umituz/react-native-settings';
180
+
181
+ export default function App() {
182
+ const appInfo = {
183
+ name: 'My Application',
184
+ version: '1.0.0',
185
+ buildNumber: '100',
186
+ developer: 'My Company',
187
+ contactEmail: 'support@example.com',
188
+ websiteUrl: 'https://example.com',
189
+ };
190
+
191
+ const legalUrls = {
192
+ privacyPolicy: 'https://example.com/privacy',
193
+ termsOfService: 'https://example.com/terms',
194
+ eula: 'https://example.com/eula',
195
+ };
196
+
197
+ const faqData = {
198
+ categories: [
199
+ {
200
+ id: 'general',
201
+ title: 'General',
202
+ questions: [
203
+ {
204
+ id: 'q1',
205
+ question: 'What is this app?',
206
+ answer: 'Description here...',
207
+ },
208
+ ],
209
+ },
210
+ ],
211
+ };
212
+
213
+ return (
214
+ <NavigationContainer>
215
+ <SettingsStackNavigator
216
+ appInfo={appInfo}
217
+ legalUrls={legalUrls}
218
+ faqData={faqData}
219
+ />
220
+ </NavigationContainer>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ### With User Profile
226
+
227
+ ```tsx
228
+ function AppWithUserProfile() {
229
+ const { user } = useAuth();
230
+
231
+ return (
232
+ <NavigationContainer>
233
+ <SettingsStackNavigator
234
+ appInfo={appInfo}
235
+ legalUrls={legalUrls}
236
+ showUserProfile={true}
237
+ userProfile={{
238
+ displayName: user?.displayName,
239
+ userId: user?.uid,
240
+ avatarUrl: user?.photoURL,
241
+ onPress: () => navigation.navigate('AccountSettings'),
242
+ }}
243
+ />
244
+ </NavigationContainer>
245
+ );
246
+ }
247
+ ```
248
+
249
+ ### With Custom Configuration
250
+
251
+ ```tsx
252
+ function AppWithCustomConfig() {
253
+ const config = {
254
+ appearance: true,
255
+ language: false,
256
+ notifications: true,
257
+ privacy: true,
258
+ support: true,
259
+ about: true,
260
+ legal: true,
261
+ feedback: true,
262
+ faqs: true,
263
+ };
264
+
265
+ return (
266
+ <NavigationContainer>
267
+ <SettingsStackNavigator
268
+ config={config}
269
+ appInfo={appInfo}
270
+ legalUrls={legalUrls}
271
+ />
272
+ </NavigationContainer>
273
+ );
274
+ }
275
+ ```
276
+
277
+ ### With Additional Screens
278
+
279
+ ```tsx
280
+ function AppWithAdditionalScreens() {
281
+ const additionalScreens = [
282
+ {
283
+ name: 'AccountSettings' as const,
284
+ component: AccountSettingsScreen,
285
+ options: { title: 'Account' },
286
+ },
287
+ {
288
+ name: 'Integrations' as const,
289
+ options: { title: 'Integrations' },
290
+ children: () => <IntegrationsScreen />,
291
+ },
292
+ ];
293
+
294
+ return (
295
+ <NavigationContainer>
296
+ <SettingsStackNavigator
297
+ appInfo={appInfo}
298
+ legalUrls={legalUrls}
299
+ additionalScreens={additionalScreens}
300
+ />
301
+ </NavigationContainer>
302
+ );
303
+ }
304
+ ```
305
+
306
+ ### With Custom Sections
307
+
308
+ ```tsx
309
+ function AppWithCustomSections() {
310
+ const customSections = [
311
+ {
312
+ title: 'INTEGRATIONS',
313
+ items: [
314
+ {
315
+ icon: 'logo-google',
316
+ title: 'Google',
317
+ description: 'Connected',
318
+ showSwitch: true,
319
+ switchValue: googleEnabled,
320
+ onSwitchChange: setGoogleEnabled,
321
+ },
322
+ ],
323
+ },
324
+ ];
325
+
326
+ return (
327
+ <NavigationContainer>
328
+ <SettingsStackNavigator
329
+ appInfo={appInfo}
330
+ legalUrls={legalUrls}
331
+ customSections={customSections}
332
+ />
333
+ </NavigationContainer>
334
+ );
335
+ }
336
+ ```
337
+
338
+ ### With Dev Settings
339
+
340
+ ```tsx
341
+ import { DevSettingsSection } from '@umituz/react-native-settings';
342
+
343
+ function AppWithDevSettings() {
344
+ return (
345
+ <NavigationContainer>
346
+ <SettingsStackNavigator
347
+ appInfo={appInfo}
348
+ legalUrls={legalUrls}
349
+ devSettings={{
350
+ enabled: true,
351
+ onAfterClear: async () => {
352
+ await resetApp();
353
+ Updates.reloadAsync();
354
+ },
355
+ }}
356
+ />
357
+ </NavigationContainer>
358
+ );
359
+ }
360
+ ```
361
+
362
+ ## Navigation Types
363
+
364
+ ### SettingsStackParamList
365
+
366
+ Type definition for all navigation params:
367
+
368
+ ```typescript
369
+ type SettingsStackParamList = {
370
+ SettingsMain: undefined;
371
+ Appearance: undefined;
372
+ About: { config?: AboutConfig };
373
+ Legal: LegalScreenProps;
374
+ Notifications: undefined;
375
+ FAQ: undefined;
376
+ LanguageSelection: undefined;
377
+ // ... additional screens
378
+ };
379
+ ```
380
+
381
+ ### SettingsStackNavigatorProps
382
+
383
+ ```typescript
384
+ interface SettingsStackNavigatorProps {
385
+ appInfo: AppInfo;
386
+ legalUrls: LegalUrls;
387
+ faqData?: FAQData;
388
+ config?: SettingsConfig;
389
+ showUserProfile?: boolean;
390
+ userProfile?: UserProfile;
391
+ additionalScreens?: AdditionalScreen[];
392
+ devSettings?: DevSettingsProps;
393
+ customSections?: CustomSettingsSection[];
394
+ }
395
+ ```
396
+
397
+ ## Screen Navigation
398
+
399
+ ### Navigate to Screens
400
+
401
+ ```tsx
402
+ import { useNavigation } from '@react-navigation/native';
403
+
404
+ function SettingsComponent() {
405
+ const navigation = useNavigation();
406
+
407
+ return (
408
+ <View>
409
+ <Button
410
+ title="Go to Appearance"
411
+ onPress={() => navigation.navigate('Appearance')}
412
+ />
413
+ <Button
414
+ title="Go to About"
415
+ onPress={() => navigation.navigate('About')}
416
+ />
417
+ <Button
418
+ title="Go to Legal"
419
+ onPress={() => navigation.navigate('Legal')}
420
+ />
421
+ </View>
422
+ );
423
+ }
424
+ ```
425
+
426
+ ### With Parameters
427
+
428
+ ```tsx
429
+ <Button
430
+ title="Go to About"
431
+ onPress={() =>
432
+ navigation.navigate('About', {
433
+ config: {
434
+ appName: 'My App',
435
+ version: '1.0.0',
436
+ },
437
+ })
438
+ }
439
+ />
440
+ ```
441
+
442
+ ## Screen Wrappers Usage
443
+
444
+ Screen wrappers handle configuration and provide props to screens automatically:
445
+
446
+ ```tsx
447
+ // Instead of this:
448
+ <Stack.Screen name="About">
449
+ {() => (
450
+ <AboutScreen
451
+ config={{
452
+ appName: appInfo.name,
453
+ version: appInfo.version,
454
+ // ... manually pass all props
455
+ }}
456
+ />
457
+ )}
458
+ </Stack.Screen>
459
+
460
+ // Use this:
461
+ <Stack.Screen name="About">
462
+ {() => <AboutScreenWrapper config={aboutConfig} />}
463
+ </Stack.Screen>
464
+ ```
465
+
466
+ ## Best Practices
467
+
468
+ 1. **Screen Wrappers**: Always use screen wrappers for consistent configuration
469
+ 2. **Type Safety**: Use TypeScript types for navigation params
470
+ 3. **Error Boundaries**: Include error boundaries in navigation
471
+ 4. **Translation Keys**: Use translation keys for all text
472
+ 5. **Deep Linking**: Support deep linking to settings screens
473
+ 6. **Custom Screens**: Use `additionalScreens` for custom screens
474
+ 7. **Configuration**: Pass config through props, not hardcoded
475
+ 8. **User Profile**: Show user profile when user is authenticated
476
+
477
+ ## Testing
478
+
479
+ ```tsx
480
+ import { render } from '@testing-library/react-native';
481
+ import { SettingsStackNavigator } from '@umituz/react-native-navigation';
482
+ import { NavigationContainer } from '@react-navigation/native';
483
+
484
+ describe('SettingsStackNavigator', () => {
485
+ const mockAppInfo = {
486
+ name: 'Test App',
487
+ version: '1.0.0',
488
+ };
489
+
490
+ const mockLegalUrls = {
491
+ privacyPolicy: 'https://test.com/privacy',
492
+ termsOfService: 'https://test.com/terms',
493
+ };
494
+
495
+ it('renders settings stack', () => {
496
+ const { getByText } = render(
497
+ <NavigationContainer>
498
+ <SettingsStackNavigator
499
+ appInfo={mockAppInfo}
500
+ legalUrls={mockLegalUrls}
501
+ />
502
+ </NavigationContainer>
503
+ );
504
+
505
+ expect(getByText(/settings/i)).toBeTruthy();
506
+ });
507
+
508
+ it('navigates to appearance screen', () => {
509
+ const { getByText } = render(
510
+ <NavigationContainer>
511
+ <SettingsStackNavigator
512
+ appInfo={mockAppInfo}
513
+ legalUrls={mockLegalUrls}
514
+ />
515
+ </NavigationContainer>
516
+ );
517
+
518
+ fireEvent.press(getByText(/appearance/i));
519
+ expect(getByText(/theme/i)).toBeTruthy();
520
+ });
521
+ });
522
+ ```
523
+
524
+ ## Related
525
+
526
+ - **Presentation Screens**: Screen components
527
+ - **Navigation Hooks**: Custom navigation hooks
528
+ - **React Navigation**: Official React Navigation docs
529
+
530
+ ## License
531
+
532
+ MIT