@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.
- 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,482 @@
|
|
|
1
|
+
# Core Settings Components
|
|
2
|
+
|
|
3
|
+
Reusable core components for building settings screens in React Native apps. These components provide a consistent, modern UI for settings interfaces.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
### SettingsItemCard
|
|
8
|
+
|
|
9
|
+
A premium, consistent card component for settings items with icons, text, and optional controls.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { SettingsItemCard } from '@umituz/react-native-settings';
|
|
13
|
+
|
|
14
|
+
// Basic clickable item
|
|
15
|
+
<SettingsItemCard
|
|
16
|
+
icon="settings-outline"
|
|
17
|
+
title="Settings"
|
|
18
|
+
description="Configure your preferences"
|
|
19
|
+
onPress={() => navigation.navigate('Settings')}
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
// With switch
|
|
23
|
+
<SettingsItemCard
|
|
24
|
+
icon="notifications-outline"
|
|
25
|
+
title="Notifications"
|
|
26
|
+
showSwitch={true}
|
|
27
|
+
switchValue={enabled}
|
|
28
|
+
onSwitchChange={setEnabled}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
// Disabled state
|
|
32
|
+
<SettingsItemCard
|
|
33
|
+
icon="cloud-outline"
|
|
34
|
+
title="Cloud Sync"
|
|
35
|
+
description="Sync disabled"
|
|
36
|
+
disabled={true}
|
|
37
|
+
/>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| `title` | `string` | **Required** | Item title |
|
|
45
|
+
| `icon` | `IconName` | **Required** | Icon from design system |
|
|
46
|
+
| `description` | `string` | `undefined` | Optional description/value |
|
|
47
|
+
| `onPress` | `() => void` | `undefined` | Press handler |
|
|
48
|
+
| `showSwitch` | `boolean` | `false` | Show switch toggle |
|
|
49
|
+
| `switchValue` | `boolean` | `undefined` | Switch state |
|
|
50
|
+
| `onSwitchChange` | `(val) => void` | `undefined` | Switch change handler |
|
|
51
|
+
| `rightIcon` | `IconName` | `'chevron-forward'` | Custom right icon |
|
|
52
|
+
| `iconBgColor` | `string` | `primary with opacity` | Icon background |
|
|
53
|
+
| `iconColor` | `string` | `primary` | Icon color |
|
|
54
|
+
| `showChevron` | `boolean` | `auto` | Force chevron visibility |
|
|
55
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
56
|
+
| `containerStyle` | `ViewStyle` | `undefined` | Custom container style |
|
|
57
|
+
| `sectionTitle` | `string` | `undefined` | Section title above item |
|
|
58
|
+
|
|
59
|
+
#### Examples
|
|
60
|
+
|
|
61
|
+
**Settings Navigation:**
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<SettingsItemCard
|
|
65
|
+
icon="person-outline"
|
|
66
|
+
title="Account"
|
|
67
|
+
description="Manage your account"
|
|
68
|
+
onPress={() => navigation.navigate('Account')}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<SettingsItemCard
|
|
72
|
+
icon="moon-outline"
|
|
73
|
+
title="Appearance"
|
|
74
|
+
description="Theme, colors"
|
|
75
|
+
onPress={() => navigation.navigate('Appearance')}
|
|
76
|
+
/>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Toggle Switches:**
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<SettingsItemCard
|
|
83
|
+
icon="notifications-outline"
|
|
84
|
+
title="Push Notifications"
|
|
85
|
+
showSwitch={true}
|
|
86
|
+
switchValue={pushEnabled}
|
|
87
|
+
onSwitchChange={setPushEnabled}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<SettingsItemCard
|
|
91
|
+
icon="volume-high-outline"
|
|
92
|
+
title="Sound Effects"
|
|
93
|
+
description="Play sounds for actions"
|
|
94
|
+
showSwitch={true}
|
|
95
|
+
switchValue={soundEnabled}
|
|
96
|
+
onSwitchChange={setSoundEnabled}
|
|
97
|
+
/>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**With Custom Icons:**
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<SettingsItemCard
|
|
104
|
+
icon="shield-checkmark-outline"
|
|
105
|
+
title="Privacy"
|
|
106
|
+
description="Manage your privacy"
|
|
107
|
+
iconColor="#10B981"
|
|
108
|
+
iconBgColor="rgba(16, 185, 129, 0.1)"
|
|
109
|
+
onPress={() => navigation.navigate('Privacy')}
|
|
110
|
+
/>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**With Right Icon:**
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
<SettingsItemCard
|
|
117
|
+
icon="globe-outline"
|
|
118
|
+
title="Language"
|
|
119
|
+
description="English"
|
|
120
|
+
rightIcon="chevron-down"
|
|
121
|
+
onPress={() => setShowLanguagePicker(true)}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### SettingsSection
|
|
126
|
+
|
|
127
|
+
Section container for grouping related settings items with a title.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { SettingsSection } from '@umituz/react-native-settings';
|
|
131
|
+
|
|
132
|
+
<SettingsSection title="PREFERENCES">
|
|
133
|
+
<SettingsItemCard icon="moon-outline" title="Dark Mode" showSwitch={true} />
|
|
134
|
+
<SettingsItemCard icon="globe-outline" title="Language" description="English" />
|
|
135
|
+
</SettingsSection>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Props
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Default | Description |
|
|
141
|
+
|------|------|---------|-------------|
|
|
142
|
+
| `title` | `string` | **Required** | Section title |
|
|
143
|
+
| `children` | `ReactNode` | **Required** | Section content |
|
|
144
|
+
|
|
145
|
+
#### Example
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
<View>
|
|
149
|
+
<SettingsSection title="GENERAL">
|
|
150
|
+
<SettingsItemCard
|
|
151
|
+
icon="person-outline"
|
|
152
|
+
title="Account"
|
|
153
|
+
onPress={handleAccount}
|
|
154
|
+
/>
|
|
155
|
+
<SettingsItemCard
|
|
156
|
+
icon="notifications-outline"
|
|
157
|
+
title="Notifications"
|
|
158
|
+
onPress={handleNotifications}
|
|
159
|
+
/>
|
|
160
|
+
</SettingsSection>
|
|
161
|
+
|
|
162
|
+
<SettingsSection title="APPEARANCE">
|
|
163
|
+
<SettingsItemCard
|
|
164
|
+
icon="moon-outline"
|
|
165
|
+
title="Dark Mode"
|
|
166
|
+
showSwitch={true}
|
|
167
|
+
switchValue={isDarkMode}
|
|
168
|
+
onSwitchChange={setDarkMode}
|
|
169
|
+
/>
|
|
170
|
+
<SettingsItemCard
|
|
171
|
+
icon="color-palette-outline"
|
|
172
|
+
title="Theme Color"
|
|
173
|
+
description="Blue"
|
|
174
|
+
onPress={handleThemeColor}
|
|
175
|
+
/>
|
|
176
|
+
</SettingsSection>
|
|
177
|
+
</View>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### SettingsFooter
|
|
181
|
+
|
|
182
|
+
Footer component displaying app version information.
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import { SettingsFooter } from '@umituz/react-native-settings';
|
|
186
|
+
|
|
187
|
+
<SettingsFooter versionText="Version 1.0.0" />
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Props
|
|
191
|
+
|
|
192
|
+
| Prop | Type | Default | Description |
|
|
193
|
+
|------|------|---------|-------------|
|
|
194
|
+
| `versionText` | `string` | `undefined` | Custom version text |
|
|
195
|
+
|
|
196
|
+
#### Example
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import { SettingsFooter } from '@umituz/react-native-settings';
|
|
200
|
+
import { Constants } from 'expo-constants';
|
|
201
|
+
|
|
202
|
+
function MySettingsScreen() {
|
|
203
|
+
const version = Constants.expoConfig?.version || '1.0.0';
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<View>
|
|
207
|
+
{/* Settings content */}
|
|
208
|
+
|
|
209
|
+
<SettingsFooter versionText={`Version ${version}`} />
|
|
210
|
+
</View>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### SettingsErrorBoundary
|
|
216
|
+
|
|
217
|
+
Error boundary component for catching and displaying errors in settings screens.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { SettingsErrorBoundary } from '@umituz/react-native-settings';
|
|
221
|
+
|
|
222
|
+
<SettingsErrorBoundary
|
|
223
|
+
fallbackTitle="custom.error.title"
|
|
224
|
+
fallbackMessage="custom.error.message"
|
|
225
|
+
>
|
|
226
|
+
<YourSettingsComponents />
|
|
227
|
+
</SettingsErrorBoundary>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### Props
|
|
231
|
+
|
|
232
|
+
| Prop | Type | Default | Description |
|
|
233
|
+
|------|------|---------|-------------|
|
|
234
|
+
| `children` | `ReactNode` | **Required** | Child components |
|
|
235
|
+
| `fallback` | `ReactNode` | `undefined` | Custom fallback component |
|
|
236
|
+
| `fallbackTitle` | `string` | `undefined` | Error title translation key |
|
|
237
|
+
| `fallbackMessage` | `string` | `undefined` | Error message translation key |
|
|
238
|
+
|
|
239
|
+
#### Example
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
<SettingsErrorBoundary
|
|
243
|
+
fallbackTitle="settings_error"
|
|
244
|
+
fallbackMessage="settings_error_message"
|
|
245
|
+
>
|
|
246
|
+
<SettingsScreen />
|
|
247
|
+
</SettingsErrorBoundary>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Custom Fallback:**
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
const customFallback = (
|
|
254
|
+
<View style={{ padding: 20, alignItems: 'center' }}>
|
|
255
|
+
<Icon name="warning" size={64} color="#F59E0B" />
|
|
256
|
+
<Text style={{ fontSize: 18, fontWeight: 'bold', marginTop: 16 }}>
|
|
257
|
+
Settings Error
|
|
258
|
+
</Text>
|
|
259
|
+
<Button title="Retry" onPress={() => window.location.reload()} />
|
|
260
|
+
</View>
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
<SettingsErrorBoundary fallback={customFallback}>
|
|
264
|
+
<SettingsContent />
|
|
265
|
+
</SettingsErrorBoundary>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Complete Examples
|
|
269
|
+
|
|
270
|
+
### Basic Settings Screen
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
import React from 'react';
|
|
274
|
+
import { View, ScrollView } from 'react-native';
|
|
275
|
+
import { SettingsSection, SettingsItemCard, SettingsFooter } from '@umituz/react-native-settings';
|
|
276
|
+
|
|
277
|
+
function BasicSettingsScreen() {
|
|
278
|
+
return (
|
|
279
|
+
<ScrollView style={{ flex: 1 }}>
|
|
280
|
+
<SettingsSection title="PREFERENCES">
|
|
281
|
+
<SettingsItemCard
|
|
282
|
+
icon="moon-outline"
|
|
283
|
+
title="Dark Mode"
|
|
284
|
+
showSwitch={true}
|
|
285
|
+
switchValue={isDarkMode}
|
|
286
|
+
onSwitchChange={setDarkMode}
|
|
287
|
+
/>
|
|
288
|
+
<SettingsItemCard
|
|
289
|
+
icon="globe-outline"
|
|
290
|
+
title="Language"
|
|
291
|
+
description="English"
|
|
292
|
+
onPress={() => {}}
|
|
293
|
+
/>
|
|
294
|
+
</SettingsSection>
|
|
295
|
+
|
|
296
|
+
<SettingsSection title="SUPPORT">
|
|
297
|
+
<SettingsItemCard
|
|
298
|
+
icon="help-circle-outline"
|
|
299
|
+
title="Help Center"
|
|
300
|
+
onPress={() => navigation.navigate('Help')}
|
|
301
|
+
/>
|
|
302
|
+
<SettingsItemCard
|
|
303
|
+
icon="chatbubble-outline"
|
|
304
|
+
title="Contact Us"
|
|
305
|
+
onPress={() => navigation.navigate('Contact')}
|
|
306
|
+
/>
|
|
307
|
+
</SettingsSection>
|
|
308
|
+
|
|
309
|
+
<SettingsFooter versionText="Version 1.0.0" />
|
|
310
|
+
</ScrollView>
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Advanced Settings Screen
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
function AdvancedSettingsScreen() {
|
|
319
|
+
const [settings, setSettings] = useState({
|
|
320
|
+
notifications: true,
|
|
321
|
+
darkMode: false,
|
|
322
|
+
soundEnabled: true,
|
|
323
|
+
autoSync: false,
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<ScreenLayout>
|
|
328
|
+
<SettingsSection title="NOTIFICATIONS">
|
|
329
|
+
<SettingsItemCard
|
|
330
|
+
icon="notifications-outline"
|
|
331
|
+
title="Push Notifications"
|
|
332
|
+
description="Receive push notifications"
|
|
333
|
+
showSwitch={true}
|
|
334
|
+
switchValue={settings.notifications}
|
|
335
|
+
onSwitchChange={(value) => setSettings({ ...settings, notifications: value })}
|
|
336
|
+
/>
|
|
337
|
+
<SettingsItemCard
|
|
338
|
+
icon="mail-outline"
|
|
339
|
+
title="Email Notifications"
|
|
340
|
+
description="Receive email updates"
|
|
341
|
+
showSwitch={true}
|
|
342
|
+
switchValue={settings.emailNotifications}
|
|
343
|
+
onSwitchChange={(value) => setSettings({ ...settings, emailNotifications: value })}
|
|
344
|
+
/>
|
|
345
|
+
</SettingsSection>
|
|
346
|
+
|
|
347
|
+
<SettingsSection title="APPEARANCE">
|
|
348
|
+
<SettingsItemCard
|
|
349
|
+
icon="moon-outline"
|
|
350
|
+
title="Dark Mode"
|
|
351
|
+
description="Use dark theme"
|
|
352
|
+
showSwitch={true}
|
|
353
|
+
switchValue={settings.darkMode}
|
|
354
|
+
onSwitchChange={(value) => setSettings({ ...settings, darkMode: value })}
|
|
355
|
+
/>
|
|
356
|
+
<SettingsItemCard
|
|
357
|
+
icon="color-palette-outline"
|
|
358
|
+
title="Theme Color"
|
|
359
|
+
description="Blue"
|
|
360
|
+
onPress={() => navigation.navigate('ThemeColor')}
|
|
361
|
+
/>
|
|
362
|
+
</SettingsSection>
|
|
363
|
+
|
|
364
|
+
<SettingsSection title="SYNC">
|
|
365
|
+
<SettingsItemCard
|
|
366
|
+
icon="cloud-outline"
|
|
367
|
+
title="Auto Sync"
|
|
368
|
+
description="Sync data automatically"
|
|
369
|
+
showSwitch={true}
|
|
370
|
+
switchValue={settings.autoSync}
|
|
371
|
+
onSwitchChange={(value) => setSettings({ ...settings, autoSync: value })}
|
|
372
|
+
/>
|
|
373
|
+
<SettingsItemCard
|
|
374
|
+
icon="refresh-outline"
|
|
375
|
+
title="Sync Now"
|
|
376
|
+
description="Last synced: 5 minutes ago"
|
|
377
|
+
onPress={handleManualSync}
|
|
378
|
+
/>
|
|
379
|
+
</SettingsSection>
|
|
380
|
+
|
|
381
|
+
<SettingsFooter versionText={`Version ${Constants.expoConfig.version}`} />
|
|
382
|
+
</ScreenLayout>
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### With Error Boundary
|
|
388
|
+
|
|
389
|
+
```tsx
|
|
390
|
+
function SettingsScreenWithErrorBoundary() {
|
|
391
|
+
return (
|
|
392
|
+
<SettingsErrorBoundary
|
|
393
|
+
fallbackTitle="settings.error.title"
|
|
394
|
+
fallbackMessage="settings.error.message"
|
|
395
|
+
>
|
|
396
|
+
<SettingsContent />
|
|
397
|
+
</SettingsErrorBoundary>
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Styling
|
|
403
|
+
|
|
404
|
+
All components use the design system tokens for consistent styling:
|
|
405
|
+
|
|
406
|
+
- **Colors**: Automatically adapts to light/dark theme
|
|
407
|
+
- **Spacing**: Consistent spacing using design tokens
|
|
408
|
+
- **Typography**: Design system typography scale
|
|
409
|
+
- **Icons**: AtomicIcon component from design system
|
|
410
|
+
- **Border Radius**: Consistent corner radius
|
|
411
|
+
|
|
412
|
+
## Best Practices
|
|
413
|
+
|
|
414
|
+
1. **Group Related Items**: Use `SettingsSection` to group related settings
|
|
415
|
+
2. **Clear Descriptions**: Provide helpful descriptions for settings
|
|
416
|
+
3. **Consistent Icons**: Use consistent icon styles across items
|
|
417
|
+
4. **Switch Usage**: Use switches for binary settings (on/off)
|
|
418
|
+
5. **Navigation**: Use chevron for navigation actions, switches for settings
|
|
419
|
+
6. **Accessibility**: Provide clear labels and descriptions
|
|
420
|
+
7. **Error Handling**: Always wrap screens in `SettingsErrorBoundary`
|
|
421
|
+
8. **Version Info**: Include footer with app version
|
|
422
|
+
|
|
423
|
+
## Testing
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
import { render, fireEvent } from '@testing-library/react-native';
|
|
427
|
+
import { SettingsItemCard, SettingsSection } from '@umituz/react-native-settings';
|
|
428
|
+
|
|
429
|
+
describe('SettingsItemCard', () => {
|
|
430
|
+
it('renders title and icon', () => {
|
|
431
|
+
const { getByText } = render(
|
|
432
|
+
<SettingsItemCard
|
|
433
|
+
icon="settings-outline"
|
|
434
|
+
title="Settings"
|
|
435
|
+
/>
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
expect(getByText('Settings')).toBeTruthy();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('handles press events', () => {
|
|
442
|
+
const mockPress = jest.fn();
|
|
443
|
+
const { getByTestId } = render(
|
|
444
|
+
<SettingsItemCard
|
|
445
|
+
icon="settings-outline"
|
|
446
|
+
title="Settings"
|
|
447
|
+
onPress={mockPress}
|
|
448
|
+
/>
|
|
449
|
+
);
|
|
450
|
+
|
|
451
|
+
fireEvent.press(getByTestId('settings-item-card'));
|
|
452
|
+
expect(mockPress).toHaveBeenCalled();
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
it('handles switch changes', () => {
|
|
456
|
+
const mockChange = jest.fn();
|
|
457
|
+
const { getByTestId } = render(
|
|
458
|
+
<SettingsItemCard
|
|
459
|
+
icon="notifications-outline"
|
|
460
|
+
title="Notifications"
|
|
461
|
+
showSwitch={true}
|
|
462
|
+
switchValue={false}
|
|
463
|
+
onSwitchChange={mockChange}
|
|
464
|
+
/>
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
const switch = getByTestId('switch');
|
|
468
|
+
fireEvent(switch, 'onValueChange', true);
|
|
469
|
+
expect(mockChange).toHaveBeenCalledWith(true);
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Related
|
|
475
|
+
|
|
476
|
+
- **SettingsScreen**: Main settings screen component
|
|
477
|
+
- **Settings Sections**: Feature-specific section components
|
|
478
|
+
- **Design System**: Styling and theming foundation
|
|
479
|
+
|
|
480
|
+
## License
|
|
481
|
+
|
|
482
|
+
MIT
|