@umituz/react-native-settings 4.20.58 → 4.20.59

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 (64) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
  2. package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
  5. package/AI_AGENT_GUIDELINES.md +367 -0
  6. package/ARCHITECTURE.md +246 -0
  7. package/CHANGELOG.md +67 -0
  8. package/CODE_OF_CONDUCT.md +75 -0
  9. package/CONTRIBUTING.md +107 -0
  10. package/DOCUMENTATION_MIGRATION.md +319 -0
  11. package/DOCUMENTATION_TEMPLATE.md +155 -0
  12. package/LICENSE +21 -0
  13. package/README.md +321 -498
  14. package/SECURITY.md +98 -0
  15. package/SETTINGS_SCREEN_GUIDE.md +185 -0
  16. package/TESTING.md +358 -0
  17. package/package.json +13 -2
  18. package/src/application/README.md +85 -271
  19. package/src/domains/about/README.md +85 -440
  20. package/src/domains/about/presentation/hooks/README.md +93 -348
  21. package/src/domains/appearance/README.md +95 -584
  22. package/src/domains/appearance/hooks/README.md +95 -303
  23. package/src/domains/appearance/infrastructure/services/README.md +83 -397
  24. package/src/domains/appearance/presentation/components/README.md +95 -489
  25. package/src/domains/cloud-sync/README.md +73 -439
  26. package/src/domains/cloud-sync/presentation/components/README.md +95 -493
  27. package/src/domains/dev/README.md +71 -457
  28. package/src/domains/disclaimer/README.md +77 -411
  29. package/src/domains/disclaimer/presentation/components/README.md +95 -392
  30. package/src/domains/faqs/README.md +86 -574
  31. package/src/domains/feedback/README.md +79 -553
  32. package/src/domains/feedback/presentation/hooks/README.md +93 -426
  33. package/src/domains/legal/README.md +88 -537
  34. package/src/domains/rating/README.md +73 -440
  35. package/src/domains/rating/presentation/components/README.md +95 -475
  36. package/src/domains/video-tutorials/README.md +77 -470
  37. package/src/domains/video-tutorials/presentation/components/README.md +95 -431
  38. package/src/infrastructure/README.md +78 -425
  39. package/src/infrastructure/repositories/README.md +88 -420
  40. package/src/infrastructure/services/README.md +74 -460
  41. package/src/presentation/components/README.md +97 -480
  42. package/src/presentation/components/SettingsErrorBoundary/README.md +48 -436
  43. package/src/presentation/components/SettingsFooter/README.md +48 -427
  44. package/src/presentation/components/SettingsItemCard/README.md +152 -391
  45. package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
  46. package/src/presentation/components/SettingsSection/README.md +47 -401
  47. package/src/presentation/hooks/README.md +95 -389
  48. package/src/presentation/hooks/mutations/README.md +99 -376
  49. package/src/presentation/hooks/queries/README.md +111 -353
  50. package/src/presentation/navigation/README.md +70 -502
  51. package/src/presentation/navigation/components/README.md +70 -295
  52. package/src/presentation/navigation/hooks/README.md +75 -367
  53. package/src/presentation/navigation/utils/README.md +100 -380
  54. package/src/presentation/screens/README.md +53 -504
  55. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  56. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  57. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  58. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  59. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  60. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  61. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  62. package/src/presentation/screens/hooks/README.md +64 -354
  63. package/src/presentation/screens/types/README.md +79 -409
  64. package/src/presentation/screens/utils/README.md +65 -255
@@ -2,387 +2,75 @@
2
2
 
3
3
  Component for rendering custom, user-defined settings sections with automatic ordering and sorting.
4
4
 
5
- ## Features
5
+ ## Purpose
6
6
 
7
- - **Custom Sections**: Add app-specific settings sections
8
- - **Automatic Sorting**: Sorts sections by order property
9
- - **Flexible Content**: Support for items or custom content
10
- - **Full Customization**: Complete control over styling and behavior
7
+ Enables developers to add app-specific settings sections that integrate seamlessly with the standard settings. Provides flexible rendering options for both standard items and custom content, with automatic sorting based on order property.
11
8
 
12
- ## Installation
9
+ ## File Paths
13
10
 
14
- This component is part of `@umituz/react-native-settings`.
11
+ - **Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/sections/CustomSettingsList/CustomSettingsList.tsx`
12
+ - **Settings Section**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/sections/SettingsSection.tsx`
13
+ - **Settings Item Card**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/sections/SettingsItemCard.tsx`
15
14
 
16
- ## Usage
15
+ ## Strategy
17
16
 
18
- ### Basic Usage
17
+ 1. **Automatic Sorting**: Sort sections by order property (lower numbers appear first, default is 999)
18
+ 2. **Flexible Content**: Support both standard items array and custom React nodes for maximum flexibility
19
+ 3. **Type Safety**: Provide TypeScript interfaces for custom sections and items to ensure type safety
20
+ 4. **Conditional Rendering**: Return null when no sections are provided to avoid unnecessary rendering
21
+ 5. **Integration**: Use standard SettingsSection and SettingsItemCard components for consistency
19
22
 
20
- ```tsx
21
- import { CustomSettingsList } from '@umituz/react-native-settings';
23
+ ## Restrictions
22
24
 
23
- function MySettingsScreen() {
24
- const customSections = [
25
- {
26
- id: 'integrations',
27
- title: 'INTEGRATIONS',
28
- order: 1,
29
- items: [
30
- {
31
- id: 'google',
32
- title: 'Google',
33
- subtitle: 'Connected',
34
- icon: 'logo-google',
35
- onPress: () => console.log('Google settings'),
36
- },
37
- ],
38
- },
39
- ];
25
+ - ❌ DO NOT use this component for standard built-in features (About, Legal, Feedback, etc.)
26
+ - DO NOT add business logic within custom sections; keep logic in parent components
27
+ - ❌ NEVER assume order property exists; always provide default sorting behavior
28
+ - ❌ AVOID mixing custom sections with standard sections in the same configuration
29
+ - ❌ DO NOT duplicate standard feature functionality in custom sections
30
+ - ❌ NEVER bypass the SettingsSection wrapper for standard items
31
+ - ❌ AVOID creating deeply nested custom content structures
40
32
 
41
- return <CustomSettingsList customSections={customSections} />;
42
- }
43
- ```
33
+ ## Rules
44
34
 
45
- ## Props
35
+ - ✅ MUST accept an array of custom sections as prop
36
+ - ✅ MUST sort sections by order property ascending
37
+ - ✅ MUST render each section using SettingsSection component
38
+ - ✅ MUST render items using SettingsItemCard component
39
+ - ✅ MUST support custom React nodes for content property
40
+ - ✅ MUST return null when customSections array is empty
41
+ - ✅ SHOULD provide unique IDs for sections and items when possible
42
+ - ✅ MUST preserve rendering order for sections with equal order values
46
43
 
47
- ### CustomSettingsListProps
44
+ ## AI Agent Guidelines
48
45
 
49
- | Prop | Type | Default | Description |
50
- |------|------|---------|-------------|
51
- | `customSections` | `CustomSettingsSection[]` | `[]` | Array of custom sections |
46
+ When working with CustomSettingsList:
52
47
 
53
- ### CustomSettingsSection
48
+ 1. **Feature Categorization**: Use this component ONLY for app-specific features that don't fit into standard categories. DO NOT use it for About, Legal, Account, Notifications, etc.
54
49
 
55
- ```typescript
56
- interface CustomSettingsSection {
57
- id?: string; // Unique identifier
58
- title: string; // Section title
59
- order?: number; // Display order (lower = first)
60
- content?: ReactNode; // Custom content (instead of items)
61
- items?: CustomSettingsItem[]; // Array of items
62
- }
63
- ```
50
+ 2. **Section Design**: Create logical groupings of related items. Each section should represent a coherent feature category (e.g., "Integrations", "Preferences", "Advanced").
64
51
 
65
- ### CustomSettingsItem
52
+ 3. **Order Management**: Always set the order property for predictable rendering. Use gaps in order numbers (10, 20, 30) to allow for future insertions.
66
53
 
67
- ```typescript
68
- interface CustomSettingsItem {
69
- id?: string; // Unique identifier
70
- title: string; // Item title
71
- subtitle?: string; // Item description
72
- icon: IconName; // Icon name
73
- onPress?: () => void; // Press handler
74
- rightIcon?: IconName; // Custom right icon
75
- iconBgColor?: string; // Icon background color
76
- iconColor?: string; // Icon color
77
- }
78
- ```
54
+ 4. **Item Configuration**: Use appropriate icons from the icon library. Provide clear titles and helpful subtitles for better user experience.
79
55
 
80
- ## Examples
56
+ 5. **Custom Content**: Use the content property only when items array is insufficient. Custom content should be well-contained and not break the settings visual pattern.
81
57
 
82
- ### Simple Section
58
+ 6. **Dynamic Sections**: When generating sections dynamically, ensure stable IDs to prevent unnecessary re-renders.
83
59
 
84
- ```tsx
85
- const sections = [
86
- {
87
- title: 'PREFERENCES',
88
- items: [
89
- {
90
- id: 'theme',
91
- title: 'Theme',
92
- subtitle: 'Dark',
93
- icon: 'moon-outline',
94
- onPress: () => navigation.navigate('Theme'),
95
- },
96
- ],
97
- },
98
- ];
60
+ 7. **Conditional Rendering**: Handle conditional rendering at the data level (filter sections array) rather than within individual sections.
99
61
 
100
- return <CustomSettingsList customSections={sections} />;
101
- ```
62
+ 8. **Navigation Handlers**: Always provide onPress handlers for interactive items. Use proper navigation patterns for your app.
102
63
 
103
- ### Multiple Sections
64
+ 9. **Consistency**: Maintain visual consistency with standard settings sections. Use standard icons and spacing.
104
65
 
105
- ```tsx
106
- const sections = [
107
- {
108
- id: 'account',
109
- title: 'ACCOUNT',
110
- order: 1,
111
- items: [
112
- {
113
- id: 'profile',
114
- title: 'Profile',
115
- icon: 'person-outline',
116
- onPress: () => navigation.navigate('Profile'),
117
- },
118
- {
119
- id: 'security',
120
- title: 'Security',
121
- icon: 'shield-checkmark-outline',
122
- onPress: () => navigation.navigate('Security'),
123
- },
124
- ],
125
- },
126
- {
127
- id: 'integrations',
128
- title: 'INTEGRATIONS',
129
- order: 2,
130
- items: [
131
- {
132
- id: 'slack',
133
- title: 'Slack',
134
- subtitle: 'Connected',
135
- icon: 'logo-slack',
136
- onPress: () => manageSlack(),
137
- },
138
- {
139
- id: 'google',
140
- title: 'Google',
141
- subtitle: 'Not connected',
142
- icon: 'logo-google',
143
- onPress: () => connectGoogle(),
144
- },
145
- ],
146
- },
147
- ];
66
+ 10. **Performance**: Avoid expensive operations in render functions. Pre-process data before passing to CustomSettingsList.
148
67
 
149
- return <CustomSettingsList customSections={sections} />;
150
- ```
68
+ 11. **Type Safety**: Define proper TypeScript types for custom section data specific to your app.
151
69
 
152
- ### With Custom Content
70
+ 12. **Testing**: Test with empty sections, single sections, multiple sections, and sections with custom content.
153
71
 
154
- ```tsx
155
- const sections = [
156
- {
157
- id: 'custom',
158
- title: 'CUSTOM SECTION',
159
- content: (
160
- <View style={{ padding: 16 }}>
161
- <Text>Custom content here</Text>
162
- <Button title="Action" onPress={handleAction} />
163
- </View>
164
- ),
165
- },
166
- ];
72
+ ## Related Components
167
73
 
168
- return <CustomSettingsList customSections={sections} />;
169
- ```
170
-
171
- ### With Ordering
172
-
173
- ```tsx
174
- const sections = [
175
- { title: 'SECOND', order: 2, items: [...] },
176
- { title: 'FIRST', order: 1, items: [...] },
177
- { title: 'THIRD', order: 3, items: [...] },
178
- ];
179
-
180
- // Will render in order: FIRST, SECOND, THIRD
181
- return <CustomSettingsList customSections={sections} />;
182
- ```
183
-
184
- ### Mixed Items and Content
185
-
186
- ```tsx
187
- const sections = [
188
- {
189
- id: 'mixed',
190
- title: 'MIXED SECTION',
191
- order: 1,
192
- items: [
193
- {
194
- id: 'item1',
195
- title: 'Regular Item',
196
- icon: 'settings-outline',
197
- onPress: () => {},
198
- },
199
- ],
200
- },
201
- {
202
- id: 'custom-content',
203
- title: 'CUSTOM CONTENT',
204
- order: 2,
205
- content: (
206
- <View style={{ padding: 16 }}>
207
- <Text>This is custom content</Text>
208
- </View>
209
- ),
210
- },
211
- ];
212
-
213
- return <CustomSettingsList customSections={sections} />;
214
- ```
215
-
216
- ## Advanced Examples
217
-
218
- ### With Toggle Switches
219
-
220
- ```tsx
221
- const [integrations, setIntegrations] = useState({
222
- slack: false,
223
- google: true,
224
- dropbox: false,
225
- });
226
-
227
- const sections = [
228
- {
229
- title: 'INTEGRATIONS',
230
- items: [
231
- {
232
- id: 'slack',
233
- title: 'Slack Integration',
234
- subtitle: integrations.slack ? 'Enabled' : 'Disabled',
235
- icon: 'logo-slack',
236
- showSwitch: true,
237
- switchValue: integrations.slack,
238
- onSwitchChange: (value) => setIntegrations({ ...integrations, slack: value }),
239
- },
240
- ],
241
- },
242
- ];
243
-
244
- return <CustomSettingsList customSections={sections} />;
245
- ```
246
-
247
- ### With Custom Styling
248
-
249
- ```tsx
250
- const sections = [
251
- {
252
- title: 'PRO FEATURES',
253
- items: [
254
- {
255
- id: 'upgrade',
256
- title: 'Upgrade to Pro',
257
- subtitle: 'Unlock all features',
258
- icon: 'star',
259
- iconColor: '#FFD700',
260
- iconBgColor: 'rgba(255, 215, 0, 0.1)',
261
- onPress: () => navigation.navigate('Upgrade'),
262
- },
263
- {
264
- id: 'restore',
265
- title: 'Restore Purchase',
266
- subtitle: 'Already purchased?',
267
- icon: 'refresh',
268
- onPress: () => restorePurchase(),
269
- },
270
- ],
271
- },
272
- ];
273
-
274
- return <CustomSettingsList customSections={sections} />;
275
- ```
276
-
277
- ### Dynamic Sections
278
-
279
- ```tsx
280
- function DynamicSettingsList() {
281
- const [userIntegrations, setUserIntegrations] = useState([]);
282
-
283
- useEffect(() => {
284
- loadUserIntegrations();
285
- }, []);
286
-
287
- const sections = userIntegrations.map(integration => ({
288
- id: integration.id,
289
- title: integration.name.toUpperCase(),
290
- items: [
291
- {
292
- id: integration.id,
293
- title: integration.displayName,
294
- subtitle: integration.status,
295
- icon: integration.icon,
296
- onPress: () => manageIntegration(integration),
297
- },
298
- ],
299
- }));
300
-
301
- return <CustomSettingsList customSections={sections} />;
302
- }
303
- ```
304
-
305
- ### Conditional Rendering
306
-
307
- ```tsx
308
- function ConditionalCustomList() {
309
- const { user } = useAuth();
310
-
311
- const sections = [];
312
-
313
- if (user.isAdmin) {
314
- sections.push({
315
- title: 'ADMIN',
316
- items: [
317
- {
318
- id: 'users',
319
- title: 'Manage Users',
320
- icon: 'people-outline',
321
- onPress: () => navigation.navigate('AdminUsers'),
322
- },
323
- ],
324
- });
325
- }
326
-
327
- if (user.isPremium) {
328
- sections.push({
329
- title: 'PREMIUM',
330
- items: [
331
- {
332
- id: 'premium-support',
333
- title: 'Premium Support',
334
- icon: 'headset-outline',
335
- onPress: () => contactSupport(),
336
- },
337
- ],
338
- });
339
- }
340
-
341
- return <CustomSettingsList customSections={sections} />;
342
- }
343
- ```
344
-
345
- ## Sorting Algorithm
346
-
347
- Sections are sorted by the `order` property:
348
-
349
- ```typescript
350
- const sortedSections = useMemo(() => {
351
- return Array.from(customSections)
352
- .sort((a, b) => (a.order ?? 999) - (b.order ?? 999));
353
- }, [customSections]);
354
- ```
355
-
356
- - Default order is `999` (appears last)
357
- - Lower numbers appear first
358
- - Equal order maintains array order
359
-
360
- ## Empty State
361
-
362
- Returns `null` if no sections provided:
363
-
364
- ```tsx
365
- // Renders nothing
366
- <CustomSettingsList customSections={[]} />
367
- ```
368
-
369
- ## Best Practices
370
-
371
- 1. **Order Property**: Always set order for predictable rendering
372
- 2. **Unique IDs**: Provide unique IDs for all sections and items
373
- 3. **Consistent Icons**: Use appropriate icons for each item
374
- 4. **Clear Titles**: Use clear, concise titles
375
- 5. **Subtitles**: Provide helpful subtitles for additional context
376
- 6. **Navigation**: Always provide navigation handlers
377
- 7. **Conditional Items**: Use conditional rendering for feature-gated content
378
- 8. **Custom Content**: Use custom content for complex UI
379
-
380
- ## Related
381
-
382
- - **SettingsSection**: Section wrapper component
383
- - **SettingsItemCard**: Individual item component
384
- - **SettingsContent**: Main content composer
385
-
386
- ## License
387
-
388
- MIT
74
+ - **Settings Section**: Section wrapper component
75
+ - **Settings Item Card**: Individual item component
76
+ - **Settings Content**: Main content composer