@umituz/react-native-settings 4.20.56 → 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.
- package/README.md +145 -3
- package/package.json +1 -2
- package/src/application/README.md +322 -0
- package/src/domains/about/README.md +452 -0
- package/src/domains/about/presentation/hooks/README.md +350 -0
- package/src/domains/appearance/README.md +596 -0
- package/src/domains/appearance/hooks/README.md +366 -0
- package/src/domains/appearance/infrastructure/services/README.md +455 -0
- package/src/domains/cloud-sync/README.md +451 -0
- package/src/domains/cloud-sync/presentation/components/README.md +493 -0
- package/src/domains/dev/README.md +477 -0
- package/src/domains/disclaimer/README.md +421 -0
- package/src/domains/disclaimer/presentation/components/README.md +394 -0
- package/src/domains/faqs/README.md +586 -0
- package/src/domains/feedback/README.md +565 -0
- package/src/domains/feedback/presentation/hooks/README.md +428 -0
- package/src/domains/legal/README.md +549 -0
- package/src/domains/rating/README.md +452 -0
- package/src/domains/rating/presentation/components/README.md +475 -0
- package/src/domains/video-tutorials/README.md +482 -0
- package/src/domains/video-tutorials/presentation/components/README.md +433 -0
- package/src/infrastructure/README.md +509 -0
- package/src/infrastructure/repositories/README.md +475 -0
- package/src/infrastructure/services/README.md +510 -0
- package/src/presentation/components/README.md +482 -0
- package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
- package/src/presentation/components/SettingsFooter/README.md +446 -0
- package/src/presentation/components/SettingsItemCard/README.md +457 -0
- package/src/presentation/components/SettingsSection/README.md +421 -0
- package/src/presentation/hooks/README.md +413 -0
- package/src/presentation/hooks/mutations/README.md +430 -0
- package/src/presentation/hooks/queries/README.md +441 -0
- package/src/presentation/navigation/README.md +532 -0
- package/src/presentation/navigation/components/README.md +330 -0
- package/src/presentation/navigation/hooks/README.md +399 -0
- package/src/presentation/navigation/utils/README.md +442 -0
- package/src/presentation/screens/README.md +525 -0
- package/src/presentation/screens/components/SettingsContent/README.md +404 -0
- package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
- package/src/presentation/screens/hooks/README.md +383 -0
- package/src/presentation/screens/types/README.md +439 -0
- package/src/presentation/screens/utils/README.md +288 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
# SettingsItemCard
|
|
2
|
+
|
|
3
|
+
A premium, consistent card component for settings items with icons, text, optional controls, and smooth interactions.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Versatile**: Supports buttons, switches, links, and navigation
|
|
8
|
+
- **Customizable**: Icon, title, subtitle, colors, and styles
|
|
9
|
+
- **Interactive**: Press feedback, switch controls, right icons
|
|
10
|
+
- **Accessible**: Full accessibility support with proper labels
|
|
11
|
+
- **Modern**: Gradient overlays, smooth animations
|
|
12
|
+
- **Design System**: Uses tokens for consistent styling
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This component is part of `@umituz/react-native-settings`.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Basic Clickable Item
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { SettingsItemCard } from '@umituz/react-native-settings';
|
|
24
|
+
|
|
25
|
+
function SettingsScreen() {
|
|
26
|
+
return (
|
|
27
|
+
<SettingsItemCard
|
|
28
|
+
icon="settings-outline"
|
|
29
|
+
title="Settings"
|
|
30
|
+
description="Configure your preferences"
|
|
31
|
+
onPress={() => navigation.navigate('Settings')}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With Switch
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
function NotificationsSettings() {
|
|
41
|
+
const [enabled, setEnabled] = useState(true);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<SettingsItemCard
|
|
45
|
+
icon="notifications-outline"
|
|
46
|
+
title="Notifications"
|
|
47
|
+
description="Enable push notifications"
|
|
48
|
+
showSwitch={true}
|
|
49
|
+
switchValue={enabled}
|
|
50
|
+
onSwitchChange={setEnabled}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### With Right Icon
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
function LanguageItem() {
|
|
60
|
+
return (
|
|
61
|
+
<SettingsItemCard
|
|
62
|
+
icon="globe-outline"
|
|
63
|
+
title="Language"
|
|
64
|
+
subtitle="English"
|
|
65
|
+
rightIcon="chevron-forward"
|
|
66
|
+
onPress={() => navigation.navigate('Language')}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### With Custom Colors
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
function CustomColoredItem() {
|
|
76
|
+
return (
|
|
77
|
+
<SettingsItemCard
|
|
78
|
+
icon="heart-outline"
|
|
79
|
+
title="Favorites"
|
|
80
|
+
iconBgColor="#FF5722"
|
|
81
|
+
iconColor="#FFFFFF"
|
|
82
|
+
onPress={() => navigation.navigate('Favorites')}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Props
|
|
89
|
+
|
|
90
|
+
### SettingsItemCardProps
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Default | Description |
|
|
93
|
+
|------|------|---------|-------------|
|
|
94
|
+
| `icon` | `IconName` | **Required** | Icon name from Ionicons |
|
|
95
|
+
| `title` | `string` | **Required** | Main title text |
|
|
96
|
+
| `subtitle` | `string` | `undefined` | Subtitle/description text |
|
|
97
|
+
| `description` | `string` | `undefined` | Description text (alias for subtitle) |
|
|
98
|
+
| `onPress` | `() => void` | `undefined` | Press handler |
|
|
99
|
+
| `showSwitch` | `boolean` | `false` | Show switch control |
|
|
100
|
+
| `switchValue` | `boolean` | `false` | Switch value |
|
|
101
|
+
| `onSwitchChange` | `(value: boolean) => void` | `undefined` | Switch change handler |
|
|
102
|
+
| `rightIcon` | `IconName` | `undefined` | Right arrow/icon |
|
|
103
|
+
| `iconBgColor` | `string` | `undefined` | Icon background color |
|
|
104
|
+
| `iconColor` | `string` | `undefined` | Icon foreground color |
|
|
105
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
106
|
+
| `style` | `ViewStyle` | `undefined` | Custom container style |
|
|
107
|
+
| `testID` | `string` | `undefined` | Test identifier |
|
|
108
|
+
|
|
109
|
+
## Component Structure
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
SettingsItemCard
|
|
113
|
+
├── Icon Container
|
|
114
|
+
│ ├── Icon Background (gradient)
|
|
115
|
+
│ └── Icon
|
|
116
|
+
├── Content
|
|
117
|
+
│ ├── Title
|
|
118
|
+
│ └── Subtitle/Description
|
|
119
|
+
└── Right Element
|
|
120
|
+
├── Switch (if showSwitch)
|
|
121
|
+
├── Right Icon (if rightIcon)
|
|
122
|
+
└── Chevron (default if onPress)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
### Navigation Item
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<SettingsItemCard
|
|
131
|
+
icon="person-outline"
|
|
132
|
+
title="Account"
|
|
133
|
+
subtitle="Manage your account"
|
|
134
|
+
rightIcon="chevron-forward"
|
|
135
|
+
onPress={() => navigation.navigate('Account')}
|
|
136
|
+
/>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Toggle Setting
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
const [darkMode, setDarkMode] = useState(false);
|
|
143
|
+
|
|
144
|
+
<SettingsItemCard
|
|
145
|
+
icon="moon-outline"
|
|
146
|
+
title="Dark Mode"
|
|
147
|
+
description="Enable dark theme"
|
|
148
|
+
showSwitch={true}
|
|
149
|
+
switchValue={darkMode}
|
|
150
|
+
onSwitchChange={setDarkMode}
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Link Item
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
<SettingsItemCard
|
|
158
|
+
icon="help-circle-outline"
|
|
159
|
+
title="Help & Support"
|
|
160
|
+
rightIcon="open-outline"
|
|
161
|
+
onPress={() => Linking.openURL('https://support.example.com')}
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### With Custom Icon Colors
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<SettingsItemCard
|
|
169
|
+
icon="shield-checkmark-outline"
|
|
170
|
+
title="Privacy"
|
|
171
|
+
iconBgColor="#4CAF50"
|
|
172
|
+
iconColor="white"
|
|
173
|
+
rightIcon="chevron-forward"
|
|
174
|
+
onPress={() => navigation.navigate('Privacy')}
|
|
175
|
+
/>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Disabled Item
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
<SettingsItemCard
|
|
182
|
+
icon="cloud-upload-outline"
|
|
183
|
+
title="Cloud Sync"
|
|
184
|
+
description="Not available"
|
|
185
|
+
disabled={true}
|
|
186
|
+
/>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Multiple Items in Section
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
function SettingsSection() {
|
|
193
|
+
return (
|
|
194
|
+
<SettingsSection title="GENERAL">
|
|
195
|
+
<SettingsItemCard
|
|
196
|
+
icon="person-outline"
|
|
197
|
+
title="Profile"
|
|
198
|
+
rightIcon="chevron-forward"
|
|
199
|
+
onPress={() => {}}
|
|
200
|
+
/>
|
|
201
|
+
|
|
202
|
+
<SettingsItemCard
|
|
203
|
+
icon="notifications-outline"
|
|
204
|
+
title="Notifications"
|
|
205
|
+
showSwitch={true}
|
|
206
|
+
switchValue={notifications}
|
|
207
|
+
onSwitchChange={setNotifications}
|
|
208
|
+
/>
|
|
209
|
+
|
|
210
|
+
<SettingsItemCard
|
|
211
|
+
icon="moon-outline"
|
|
212
|
+
title="Dark Mode"
|
|
213
|
+
showSwitch={true}
|
|
214
|
+
switchValue={darkMode}
|
|
215
|
+
onSwitchChange={setDarkMode}
|
|
216
|
+
/>
|
|
217
|
+
</SettingsSection>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Styling
|
|
223
|
+
|
|
224
|
+
### Default Styles
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
const styles = StyleSheet.create({
|
|
228
|
+
container: {
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
backgroundColor: tokens.colors.surface,
|
|
232
|
+
paddingVertical: tokens.spacing.md,
|
|
233
|
+
paddingHorizontal: tokens.spacing.lg,
|
|
234
|
+
marginHorizontal: tokens.spacing.lg,
|
|
235
|
+
marginTop: tokens.spacing.sm,
|
|
236
|
+
borderRadius: tokens.borderRadius.lg,
|
|
237
|
+
...tokens.shadows.sm,
|
|
238
|
+
},
|
|
239
|
+
iconContainer: {
|
|
240
|
+
width: 40,
|
|
241
|
+
height: 40,
|
|
242
|
+
borderRadius: tokens.borderRadius.md,
|
|
243
|
+
justifyContent: 'center',
|
|
244
|
+
alignItems: 'center',
|
|
245
|
+
marginRight: tokens.spacing.md,
|
|
246
|
+
},
|
|
247
|
+
icon: {
|
|
248
|
+
size: 'lg' as const,
|
|
249
|
+
},
|
|
250
|
+
content: {
|
|
251
|
+
flex: 1,
|
|
252
|
+
},
|
|
253
|
+
title: {
|
|
254
|
+
fontSize: tokens.typography.fontSize.base,
|
|
255
|
+
fontWeight: '600',
|
|
256
|
+
color: tokens.colors.textPrimary,
|
|
257
|
+
},
|
|
258
|
+
subtitle: {
|
|
259
|
+
fontSize: tokens.typography.fontSize.sm,
|
|
260
|
+
color: tokens.colors.textSecondary,
|
|
261
|
+
marginTop: 2,
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Custom Styles
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
<SettingsItemCard
|
|
270
|
+
icon="settings"
|
|
271
|
+
title="Settings"
|
|
272
|
+
style={{
|
|
273
|
+
backgroundColor: '#f0f0f0',
|
|
274
|
+
borderWidth: 1,
|
|
275
|
+
borderColor: '#ddd',
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Pressable Styles
|
|
281
|
+
|
|
282
|
+
The component uses Pressable with pressed state feedback:
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
<Pressable
|
|
286
|
+
style={({ pressed }) => [
|
|
287
|
+
styles.container,
|
|
288
|
+
{
|
|
289
|
+
backgroundColor: pressed
|
|
290
|
+
? tokens.colors.surfaceVariant
|
|
291
|
+
: tokens.colors.surface,
|
|
292
|
+
opacity: pressed ? 0.8 : 1,
|
|
293
|
+
},
|
|
294
|
+
]}
|
|
295
|
+
>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Icon Colors
|
|
299
|
+
|
|
300
|
+
### Default Icon Colors
|
|
301
|
+
|
|
302
|
+
Icon backgrounds use predefined colors based on icon type:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
const defaultIconColors = {
|
|
306
|
+
'settings-outline': '#2196F3',
|
|
307
|
+
'notifications-outline': '#FF9800',
|
|
308
|
+
'person-outline': '#9C27B0',
|
|
309
|
+
'moon-outline': '#673AB7',
|
|
310
|
+
'globe-outline': '#00BCD4',
|
|
311
|
+
'shield-checkmark-outline': '#4CAF50',
|
|
312
|
+
'help-circle-outline': '#FF5722',
|
|
313
|
+
};
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Custom Icon Colors
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
// Custom background color
|
|
320
|
+
<SettingsItemCard
|
|
321
|
+
icon="heart"
|
|
322
|
+
iconBgColor="#E91E63"
|
|
323
|
+
iconColor="white"
|
|
324
|
+
title="Favorites"
|
|
325
|
+
/>
|
|
326
|
+
|
|
327
|
+
// With gradient
|
|
328
|
+
<SettingsItemCard
|
|
329
|
+
icon="star"
|
|
330
|
+
iconBgColor="#FFD700"
|
|
331
|
+
iconColor="#333"
|
|
332
|
+
title="Premium"
|
|
333
|
+
/>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Accessibility
|
|
337
|
+
|
|
338
|
+
### Accessibility Labels
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
<SettingsItemCard
|
|
342
|
+
icon="notifications-outline"
|
|
343
|
+
title="Notifications"
|
|
344
|
+
showSwitch={true}
|
|
345
|
+
switchValue={enabled}
|
|
346
|
+
onSwitchChange={setEnabled}
|
|
347
|
+
accessible={true}
|
|
348
|
+
accessibilityLabel="Notifications setting"
|
|
349
|
+
accessibilityHint="Toggle push notifications on or off"
|
|
350
|
+
/>
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Accessibility State
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
<SettingsItemCard
|
|
357
|
+
icon="cloud-upload-outline"
|
|
358
|
+
title="Cloud Sync"
|
|
359
|
+
disabled={true}
|
|
360
|
+
accessibilityState={{ disabled: true }}
|
|
361
|
+
/>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Variants
|
|
365
|
+
|
|
366
|
+
### Minimal Variant
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
<SettingsItemCard
|
|
370
|
+
icon="arrow-back"
|
|
371
|
+
title="Back"
|
|
372
|
+
onPress={() => navigation.goBack()}
|
|
373
|
+
/>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Detailed Variant
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
<SettingsItemCard
|
|
380
|
+
icon="information-circle-outline"
|
|
381
|
+
title="About"
|
|
382
|
+
subtitle="Version 1.0.0"
|
|
383
|
+
description="Build 100"
|
|
384
|
+
rightIcon="chevron-forward"
|
|
385
|
+
onPress={() => navigation.navigate('About')}
|
|
386
|
+
/>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Control Variant
|
|
390
|
+
|
|
391
|
+
```tsx
|
|
392
|
+
<SettingsItemCard
|
|
393
|
+
icon="volume-high-outline"
|
|
394
|
+
title="Sound Effects"
|
|
395
|
+
description="Play sounds for actions"
|
|
396
|
+
showSwitch={true}
|
|
397
|
+
switchValue={soundEnabled}
|
|
398
|
+
onSwitchChange={setSoundEnabled}
|
|
399
|
+
/>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Performance
|
|
403
|
+
|
|
404
|
+
### Memoization
|
|
405
|
+
|
|
406
|
+
The component is memoized for performance:
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
export const SettingsItemCard = memo<Props>((props) => {
|
|
410
|
+
// Component implementation
|
|
411
|
+
}, (prevProps, nextProps) => {
|
|
412
|
+
return (
|
|
413
|
+
prevProps.title === nextProps.title &&
|
|
414
|
+
prevProps.subtitle === nextProps.subtitle &&
|
|
415
|
+
prevProps.switchValue === nextProps.switchValue &&
|
|
416
|
+
prevProps.disabled === nextProps.disabled
|
|
417
|
+
);
|
|
418
|
+
});
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Optimization Tips
|
|
422
|
+
|
|
423
|
+
1. **Stable Handlers**: Use useCallback for press handlers
|
|
424
|
+
2. **Memo Values**: Memoize subtitle and description values
|
|
425
|
+
3. **Avoid Inline Functions**: Don't define functions in render
|
|
426
|
+
|
|
427
|
+
```tsx
|
|
428
|
+
const handlePress = useCallback(() => {
|
|
429
|
+
navigation.navigate('Settings');
|
|
430
|
+
}, [navigation]);
|
|
431
|
+
|
|
432
|
+
<SettingsItemCard
|
|
433
|
+
icon="settings"
|
|
434
|
+
title="Settings"
|
|
435
|
+
onPress={handlePress}
|
|
436
|
+
/>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Best Practices
|
|
440
|
+
|
|
441
|
+
1. **Icons**: Use descriptive, recognizable icons
|
|
442
|
+
2. **Titles**: Keep titles short and clear
|
|
443
|
+
3. **Descriptions**: Use descriptions for context
|
|
444
|
+
4. **Consistency**: Maintain consistent styling
|
|
445
|
+
5. **Feedback**: Provide press feedback
|
|
446
|
+
6. **Accessibility**: Add proper labels
|
|
447
|
+
7. **Performance**: Use stable handlers
|
|
448
|
+
|
|
449
|
+
## Related
|
|
450
|
+
|
|
451
|
+
- **SettingsSection**: Section container component
|
|
452
|
+
- **SettingsContent**: Content composer
|
|
453
|
+
- **SettingsScreen**: Main screen component
|
|
454
|
+
|
|
455
|
+
## License
|
|
456
|
+
|
|
457
|
+
MIT
|