@umituz/react-native-settings 4.20.57 → 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 (65) 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/__tests__/setup.ts +1 -4
  19. package/src/application/README.md +85 -271
  20. package/src/domains/about/README.md +85 -440
  21. package/src/domains/about/presentation/hooks/README.md +93 -348
  22. package/src/domains/appearance/README.md +95 -584
  23. package/src/domains/appearance/hooks/README.md +95 -303
  24. package/src/domains/appearance/infrastructure/services/README.md +83 -397
  25. package/src/domains/appearance/presentation/components/README.md +99 -0
  26. package/src/domains/cloud-sync/README.md +73 -439
  27. package/src/domains/cloud-sync/presentation/components/README.md +95 -493
  28. package/src/domains/dev/README.md +71 -457
  29. package/src/domains/disclaimer/README.md +77 -411
  30. package/src/domains/disclaimer/presentation/components/README.md +95 -392
  31. package/src/domains/faqs/README.md +86 -574
  32. package/src/domains/feedback/README.md +79 -553
  33. package/src/domains/feedback/presentation/hooks/README.md +93 -426
  34. package/src/domains/legal/README.md +88 -537
  35. package/src/domains/rating/README.md +73 -440
  36. package/src/domains/rating/presentation/components/README.md +95 -475
  37. package/src/domains/video-tutorials/README.md +77 -470
  38. package/src/domains/video-tutorials/presentation/components/README.md +95 -431
  39. package/src/infrastructure/README.md +78 -425
  40. package/src/infrastructure/repositories/README.md +88 -420
  41. package/src/infrastructure/services/README.md +74 -460
  42. package/src/presentation/components/README.md +97 -480
  43. package/src/presentation/components/SettingsErrorBoundary/README.md +48 -442
  44. package/src/presentation/components/SettingsFooter/README.md +48 -427
  45. package/src/presentation/components/SettingsItemCard/README.md +153 -392
  46. package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
  47. package/src/presentation/components/SettingsSection/README.md +47 -401
  48. package/src/presentation/hooks/README.md +95 -389
  49. package/src/presentation/hooks/mutations/README.md +99 -376
  50. package/src/presentation/hooks/queries/README.md +111 -353
  51. package/src/presentation/navigation/README.md +70 -502
  52. package/src/presentation/navigation/components/README.md +70 -295
  53. package/src/presentation/navigation/hooks/README.md +75 -367
  54. package/src/presentation/navigation/utils/README.md +100 -380
  55. package/src/presentation/screens/README.md +53 -504
  56. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  57. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  58. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  59. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  60. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  61. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  62. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  63. package/src/presentation/screens/hooks/README.md +64 -354
  64. package/src/presentation/screens/types/README.md +79 -409
  65. package/src/presentation/screens/utils/README.md +65 -255
@@ -1,461 +1,67 @@
1
1
  # Settings Error Boundary
2
2
 
3
- Error boundary component for catching and handling errors in settings screens and components.
3
+ ## Purpose
4
4
 
5
- ## Features
5
+ Error boundary component for catching and handling errors in settings screens and components, providing fallback UI and error recovery options.
6
6
 
7
- - **Error Catching**: Catches JavaScript errors in component tree
8
- - **Fallback UI**: Displays user-friendly error messages
9
- - **Error Reporting**: Integrates with error tracking services
10
- - **Recovery Options**: Provide retry or reset actions
11
- - **Development Mode**: Detailed error info in development
7
+ ## File Paths
12
8
 
13
- ## Installation
9
+ - **Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/components/SettingsErrorBoundary/SettingsErrorBoundary.tsx`
14
10
 
15
- This component is part of `@umituz/react-native-settings`.
11
+ ## Strategy
16
12
 
17
- ## Usage
13
+ 1. **Error Containment**: Catches JavaScript errors in the component tree below it, preventing app crashes
14
+ 2. **User-Friendly Fallback**: Displays clear, non-technical error messages to users
15
+ 3. **Error Recovery**: Provides retry or reset actions to recover from errors
16
+ 4. **Development Support**: Shows detailed error information in development mode for debugging
17
+ 5. **Error Reporting**: Integrates with error tracking services for monitoring
18
18
 
19
- ### Basic Usage
19
+ ## Restrictions (Forbidden)
20
20
 
21
- ```tsx
22
- import { SettingsErrorBoundary } from '@umituz/react-native-settings';
21
+ ### DO NOT
22
+ - DO NOT wrap individual small components (use at screen or major section level)
23
+ - ❌ DO NOT use error boundaries to handle expected errors (e.g., network failures)
24
+ - ❌ DO NOT show technical stack traces to end users in production
23
25
 
24
- function App() {
25
- return (
26
- <SettingsErrorBoundary>
27
- <SettingsScreen />
28
- </SettingsErrorBoundary>
29
- );
30
- }
31
- ```
26
+ ### NEVER
27
+ - ❌ NEVER use error boundaries inside event handlers or async code
28
+ - ❌ NEVER use error boundaries to control flow or business logic
29
+ - ❌ NEVER expose sensitive information in error messages
32
30
 
33
- ### With Custom Fallback
31
+ ### AVOID
32
+ - ❌ AVOID nesting multiple error boundaries without clear purpose
33
+ - ❌ AVOID generic error messages that don't help users understand what happened
34
+ - ❌ AVOID blocking the entire app when a recoverable error occurs
34
35
 
35
- ```tsx
36
- function App() {
37
- return (
38
- <SettingsErrorBoundary
39
- fallback={<ErrorFallback />}
40
- onError={(error) => console.error(error)}
41
- >
42
- <SettingsScreen />
43
- </SettingsErrorBoundary>
44
- );
45
- }
36
+ ## Rules (Mandatory)
46
37
 
47
- function ErrorFallback() {
48
- return (
49
- <View style={styles.container}>
50
- <Text>Something went wrong</Text>
51
- <Button title="Retry" onPress={() => window.location.reload()} />
52
- </View>
53
- );
54
- }
55
- ```
38
+ ### ALWAYS
39
+ - ✅ ALWAYS provide a clear fallback UI when errors occur
40
+ - ✅ ALWAYS log errors for debugging and monitoring
41
+ - ALWAYS integrate with error tracking services (e.g., Sentry)
42
+ - ALWAYS show user-friendly error messages in production
56
43
 
57
- ### With Recovery Actions
44
+ ### MUST
45
+ - ✅ MUST offer recovery options (retry, reset, or navigation) to users
46
+ - ✅ MUST ensure error boundaries don't interfere with normal error handling
47
+ - ✅ MUST test error scenarios during development
58
48
 
59
- ```tsx
60
- function App() {
61
- const handleReset = () => {
62
- // Clear cache
63
- clearSettingsCache();
64
- // Reload app
65
- Updates.reloadAsync();
66
- };
49
+ ### SHOULD
50
+ - SHOULD provide context-specific error messages when possible
51
+ - SHOULD include development-only error details for debugging
52
+ - SHOULD offer a way to report errors or contact support
67
53
 
68
- return (
69
- <SettingsErrorBoundary
70
- onReset={handleReset}
71
- fallback={({ error, resetError }) => (
72
- <ErrorFallback error={error} onReset={resetError} />
73
- )}
74
- >
75
- <SettingsScreen />
76
- </SettingsErrorBoundary>
77
- );
78
- }
79
- ```
54
+ ## AI Agent Guidelines
80
55
 
81
- ## Props
56
+ 1. **File Reference**: When implementing error handling, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/components/SettingsErrorBoundary/SettingsErrorBoundary.tsx`
57
+ 2. **Placement Strategy**: Place error boundaries at strategic locations (screen level, major feature sections)
58
+ 3. **Fallback Design**: Design fallback UIs that match your app's visual design
59
+ 4. **Error Tracking**: Always integrate with error tracking services like Sentry or Crashlytics
60
+ 5. **Recovery Logic**: Implement appropriate recovery actions based on error type and context
82
61
 
83
- ### SettingsErrorBoundaryProps
62
+ ## Component Reference
84
63
 
85
- | Prop | Type | Default | Description |
86
- |------|------|---------|-------------|
87
- | `children` | `ReactNode` | **Required** | Component tree to wrap |
88
- | `fallback` | `ReactNode \| FallbackRender` | Default fallback | Fallback UI when error occurs |
89
- | `onError` | `(error: Error) => void` | `undefined` | Error callback |
90
- | `onReset` | `() => void` | `undefined` | Reset callback |
91
- | `retryButton` | `boolean` | `true` | Show retry button |
92
- | `showDetails` | `boolean` | `__DEV__` | Show error details |
93
-
94
- ### FallbackRender
95
-
96
- ```typescript
97
- type FallbackRender = (props: {
98
- error: Error;
99
- resetError: () => void;
100
- }) => ReactNode;
101
- ```
102
-
103
- ## Fallback Component
104
-
105
- ### Default Fallback
106
-
107
- ```tsx
108
- <SettingsErrorBoundary>
109
- <SettingsScreen />
110
- </SettingsErrorBoundary>
111
-
112
- // Renders on error:
113
- // ┌────────────────────────────┐
114
- // │ │
115
- // │ ⚠️ Error │
116
- // │ │
117
- // │ Something went wrong │
118
- // │ while loading settings │
119
- // │ │
120
- // │ [Try Again] │
121
- // │ │
122
- // └────────────────────────────┘
123
- ```
124
-
125
- ### Custom Fallback
126
-
127
- ```tsx
128
- function CustomFallback({ error, resetError }) {
129
- return (
130
- <View style={styles.container}>
131
- <View style={styles.iconContainer}>
132
- <Ionicons name="alert-circle-outline" size={64} color="red" />
133
- </View>
134
-
135
- <Text style={styles.title}>Oops! Something went wrong</Text>
136
-
137
- <Text style={styles.message}>
138
- {error.message || 'An unexpected error occurred'}
139
- </Text>
140
-
141
- {__DEV__ && (
142
- <Text style={styles.details}>
143
- {error.stack}
144
- </Text>
145
- )}
146
-
147
- <Button
148
- title="Try Again"
149
- onPress={resetError}
150
- style={styles.button}
151
- />
152
-
153
- <Button
154
- title="Go Back"
155
- onPress={() => navigation.goBack()}
156
- variant="secondary"
157
- />
158
- </View>
159
- );
160
- }
161
- ```
162
-
163
- ## Usage Examples
164
-
165
- ### With Error Reporting
166
-
167
- ```tsx
168
- function App() {
169
- const reportError = (error: Error) => {
170
- // Log to error tracking service
171
- Sentry.captureException(error);
172
-
173
- // Log to console
174
- console.error('Settings error:', error);
175
-
176
- // Report to analytics
177
- Analytics.track('settings_error', {
178
- message: error.message,
179
- stack: error.stack,
180
- });
181
- };
182
-
183
- return (
184
- <SettingsErrorBoundary onError={reportError}>
185
- <SettingsScreen />
186
- </SettingsErrorBoundary>
187
- );
188
- }
189
- ```
190
-
191
- ### With Context Recovery
192
-
193
- ```tsx
194
- function SettingsWithRecovery() {
195
- const [hasError, setHasError] = useState(false);
196
- const [error, setError] = useState<Error | null>(null);
197
-
198
- const handleReset = useCallback(() => {
199
- setHasError(false);
200
- setError(null);
201
- }, []);
202
-
203
- if (hasError) {
204
- return (
205
- <ErrorFallback
206
- error={error}
207
- onReset={handleReset}
208
- />
209
- );
210
- }
211
-
212
- return (
213
- <SettingsErrorBoundary
214
- onError={(error) => {
215
- setHasError(true);
216
- setError(error);
217
- }}
218
- >
219
- <SettingsScreen />
220
- </SettingsErrorBoundary>
221
- );
222
- }
223
- ```
224
-
225
- ### With Automatic Retry
226
-
227
- ```tsx
228
- function AutoRetryBoundary() {
229
- const [retryCount, setRetryCount] = useState(0);
230
- const maxRetries = 3;
231
-
232
- const handleError = (error: Error) => {
233
- if (retryCount < maxRetries) {
234
- setTimeout(() => {
235
- setRetryCount(prev => prev + 1);
236
- }, 1000);
237
- } else {
238
- Alert.alert('Error', 'Failed after multiple retries');
239
- }
240
- };
241
-
242
- return (
243
- <SettingsErrorBoundary
244
- onError={handleError}
245
- key={retryCount} // Force remount on retry
246
- >
247
- <SettingsScreen />
248
- </SettingsErrorBoundary>
249
- );
250
- }
251
- ```
252
-
253
- ### Conditional Error Boundary
254
-
255
- ```tsx
256
- function ConditionalBoundary({ enabled, children }) {
257
- if (!enabled) {
258
- return <>{children}</>;
259
- }
260
-
261
- return (
262
- <SettingsErrorBoundary>
263
- {children}
264
- </SettingsErrorBoundary>
265
- );
266
- }
267
-
268
- // Usage
269
- <ConditionalBoundary enabled={__DEV__}>
270
- <SettingsScreen />
271
- </ConditionalBoundary>
272
- ```
273
-
274
- ## Error States
275
-
276
- ### Loading State Error
277
-
278
- ```tsx
279
- function LoadingBoundary() {
280
- return (
281
- <SettingsErrorBoundary
282
- fallback={({ resetError }) => (
283
- <View style={styles.container}>
284
- <Text>Failed to load settings</Text>
285
- <Button
286
- title="Retry"
287
- onPress={resetError}
288
- />
289
- </View>
290
- )}
291
- >
292
- <SettingsScreen />
293
- </SettingsErrorBoundary>
294
- );
295
- }
296
- ```
297
-
298
- ### Mutation Error
299
-
300
- ```tsx
301
- function MutationBoundary() {
302
- return (
303
- <SettingsErrorBoundary
304
- fallback={({ error, resetError }) => (
305
- <View style={styles.container}>
306
- <Text>Failed to update settings</Text>
307
- <Text>{error.message}</Text>
308
- <Button
309
- title="Cancel"
310
- onPress={() => navigation.goBack()}
311
- />
312
- <Button
313
- title="Retry"
314
- onPress={resetError}
315
- />
316
- </View>
317
- )}
318
- >
319
- <SettingsForm />
320
- </SettingsErrorBoundary>
321
- );
322
- }
323
- ```
324
-
325
- ### Navigation Error
326
-
327
- ```tsx
328
- function NavigationBoundary() {
329
- return (
330
- <SettingsErrorBoundary
331
- fallback={({ error }) => (
332
- <View style={styles.container}>
333
- <Text>Navigation error occurred</Text>
334
- <Button
335
- title="Go Back"
336
- onPress={() => navigation.goBack()}
337
- />
338
- <Button
339
- title="Home"
340
- onPress={() => navigation.navigate('Home')}
341
- />
342
- </View>
343
- )}
344
- >
345
- <SettingsNavigator />
346
- </SettingsErrorBoundary>
347
- );
348
- }
349
- ```
350
-
351
- ## Styling
352
-
353
- ### Custom Styles
354
-
355
- ```tsx
356
- function StyledFallback({ error, resetError }) {
357
- return (
358
- <View style={styles.container}>
359
- <LinearGradient
360
- colors={['#667eea', '#764ba2']}
361
- style={styles.gradient}
362
- >
363
- <View style={styles.content}>
364
- <Ionicons
365
- name="warning-outline"
366
- size={80}
367
- color="white"
368
- style={styles.icon}
369
- />
370
-
371
- <Text style={styles.title}>Oops!</Text>
372
-
373
- <Text style={styles.message}>
374
- Something went wrong
375
- </Text>
376
-
377
- {__DEV__ && (
378
- <View style={styles.details}>
379
- <Text style={styles.errorText}>
380
- {error.message}
381
- </Text>
382
- </View>
383
- )}
384
-
385
- <TouchableOpacity
386
- style={styles.button}
387
- onPress={resetError}
388
- >
389
- <Text style={styles.buttonText}>Try Again</Text>
390
- </TouchableOpacity>
391
- </View>
392
- </LinearGradient>
393
- </View>
394
- );
395
- }
396
-
397
- const styles = StyleSheet.create({
398
- container: { flex: 1 },
399
- gradient: { flex: 1 },
400
- content: {
401
- flex: 1,
402
- justifyContent: 'center',
403
- alignItems: 'center',
404
- padding: 20,
405
- },
406
- icon: { marginBottom: 20 },
407
- title: {
408
- fontSize: 32,
409
- fontWeight: 'bold',
410
- color: 'white',
411
- marginBottom: 10,
412
- },
413
- message: {
414
- fontSize: 16,
415
- color: 'white',
416
- textAlign: 'center',
417
- marginBottom: 20,
418
- },
419
- details: {
420
- backgroundColor: 'rgba(0,0,0,0.2)',
421
- padding: 10,
422
- borderRadius: 8,
423
- marginBottom: 20,
424
- },
425
- errorText: {
426
- color: 'white',
427
- fontSize: 12,
428
- fontFamily: 'monospace',
429
- },
430
- button: {
431
- backgroundColor: 'white',
432
- paddingHorizontal: 30,
433
- paddingVertical: 15,
434
- borderRadius: 25,
435
- },
436
- buttonText: {
437
- color: '#667eea',
438
- fontWeight: 'bold',
439
- },
440
- });
441
- ```
442
-
443
- ## Best Practices
444
-
445
- 1. **Wrap Strategically**: Place boundaries at strategic locations
446
- 2. **Custom Fallbacks**: Provide context-specific fallbacks
447
- 3. **Error Reporting**: Integrate with error tracking services
448
- 4. **Recovery Actions**: Offer retry or reset options
449
- 5. **Development Details**: Show details only in development
450
- 6. **User-Friendly**: Use clear, non-technical error messages
451
- 7. **Logging**: Always log errors for debugging
452
-
453
- ## Related
454
-
455
- - **SettingsScreen**: Main screen component
456
- - **SettingsContent**: Content component
457
- - **React Error Boundaries**: Official React documentation
458
-
459
- ## License
460
-
461
- MIT
64
+ Related components:
65
+ - **SettingsScreen**: Main screen component that uses error boundaries
66
+ - **SettingsContent**: Content component wrapped by error boundaries
67
+ - **React Error Boundaries**: Official React documentation for error boundaries