@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.
- package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
- package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
- package/AI_AGENT_GUIDELINES.md +367 -0
- package/ARCHITECTURE.md +246 -0
- package/CHANGELOG.md +67 -0
- package/CODE_OF_CONDUCT.md +75 -0
- package/CONTRIBUTING.md +107 -0
- package/DOCUMENTATION_MIGRATION.md +319 -0
- package/DOCUMENTATION_TEMPLATE.md +155 -0
- package/LICENSE +21 -0
- package/README.md +321 -498
- package/SECURITY.md +98 -0
- package/SETTINGS_SCREEN_GUIDE.md +185 -0
- package/TESTING.md +358 -0
- package/package.json +13 -2
- package/src/__tests__/setup.ts +1 -4
- package/src/application/README.md +85 -271
- package/src/domains/about/README.md +85 -440
- package/src/domains/about/presentation/hooks/README.md +93 -348
- package/src/domains/appearance/README.md +95 -584
- package/src/domains/appearance/hooks/README.md +95 -303
- package/src/domains/appearance/infrastructure/services/README.md +83 -397
- package/src/domains/appearance/presentation/components/README.md +99 -0
- package/src/domains/cloud-sync/README.md +73 -439
- package/src/domains/cloud-sync/presentation/components/README.md +95 -493
- package/src/domains/dev/README.md +71 -457
- package/src/domains/disclaimer/README.md +77 -411
- package/src/domains/disclaimer/presentation/components/README.md +95 -392
- package/src/domains/faqs/README.md +86 -574
- package/src/domains/feedback/README.md +79 -553
- package/src/domains/feedback/presentation/hooks/README.md +93 -426
- package/src/domains/legal/README.md +88 -537
- package/src/domains/rating/README.md +73 -440
- package/src/domains/rating/presentation/components/README.md +95 -475
- package/src/domains/video-tutorials/README.md +77 -470
- package/src/domains/video-tutorials/presentation/components/README.md +95 -431
- package/src/infrastructure/README.md +78 -425
- package/src/infrastructure/repositories/README.md +88 -420
- package/src/infrastructure/services/README.md +74 -460
- package/src/presentation/components/README.md +97 -480
- package/src/presentation/components/SettingsErrorBoundary/README.md +48 -442
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +153 -392
- package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
- package/src/presentation/components/SettingsSection/README.md +47 -401
- package/src/presentation/hooks/README.md +95 -389
- package/src/presentation/hooks/mutations/README.md +99 -376
- package/src/presentation/hooks/queries/README.md +111 -353
- package/src/presentation/navigation/README.md +70 -502
- package/src/presentation/navigation/components/README.md +70 -295
- package/src/presentation/navigation/hooks/README.md +75 -367
- package/src/presentation/navigation/utils/README.md +100 -380
- package/src/presentation/screens/README.md +53 -504
- package/src/presentation/screens/components/SettingsContent/README.md +53 -382
- package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
- package/src/presentation/screens/hooks/README.md +64 -354
- package/src/presentation/screens/types/README.md +79 -409
- package/src/presentation/screens/utils/README.md +65 -255
|
@@ -1,461 +1,67 @@
|
|
|
1
1
|
# Settings Error Boundary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Error boundary component for catching and handling errors in settings screens and components, providing fallback UI and error recovery options.
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
9
|
+
- **Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/components/SettingsErrorBoundary/SettingsErrorBoundary.tsx`
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
## Strategy
|
|
16
12
|
|
|
17
|
-
|
|
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
|
-
|
|
19
|
+
## Restrictions (Forbidden)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62
|
+
## Component Reference
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|