@umituz/react-native-settings 4.20.56 → 4.20.58
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 +146 -4
- package/package.json +1 -2
- package/src/__tests__/setup.ts +1 -4
- 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/appearance/presentation/components/README.md +493 -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 +455 -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,421 @@
|
|
|
1
|
+
# SettingsSection
|
|
2
|
+
|
|
3
|
+
Container component for grouping related settings items with section headers and consistent styling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Grouping**: Groups related settings together
|
|
8
|
+
- **Headers**: Optional section titles with styling
|
|
9
|
+
- **Spacing**: Consistent spacing between sections
|
|
10
|
+
- **Customizable**: Custom styles and headers
|
|
11
|
+
- **Flexible**: Supports any content as children
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This component is part of `@umituz/react-native-settings`.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic Section
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { SettingsSection } from '@umituz/react-native-settings';
|
|
23
|
+
|
|
24
|
+
function GeneralSettings() {
|
|
25
|
+
return (
|
|
26
|
+
<SettingsSection title="GENERAL">
|
|
27
|
+
<SettingsItemCard
|
|
28
|
+
icon="person-outline"
|
|
29
|
+
title="Profile"
|
|
30
|
+
rightIcon="chevron-forward"
|
|
31
|
+
onPress={() => {}}
|
|
32
|
+
/>
|
|
33
|
+
<SettingsItemCard
|
|
34
|
+
icon="notifications-outline"
|
|
35
|
+
title="Notifications"
|
|
36
|
+
showSwitch={true}
|
|
37
|
+
switchValue={enabled}
|
|
38
|
+
onSwitchChange={setEnabled}
|
|
39
|
+
/>
|
|
40
|
+
</SettingsSection>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Without Title
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
function UntitledSection() {
|
|
49
|
+
return (
|
|
50
|
+
<SettingsSection>
|
|
51
|
+
<SettingsItemCard
|
|
52
|
+
icon="settings-outline"
|
|
53
|
+
title="Settings"
|
|
54
|
+
onPress={() => {}}
|
|
55
|
+
/>
|
|
56
|
+
</SettingsSection>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### With Custom Style
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
function StyledSection() {
|
|
65
|
+
return (
|
|
66
|
+
<SettingsSection
|
|
67
|
+
title="APPEARANCE"
|
|
68
|
+
style={{ backgroundColor: '#f5f5f5' }}
|
|
69
|
+
titleStyle={{ color: '#2196F3' }}
|
|
70
|
+
>
|
|
71
|
+
<SettingsItemCard
|
|
72
|
+
icon="moon-outline"
|
|
73
|
+
title="Dark Mode"
|
|
74
|
+
showSwitch={true}
|
|
75
|
+
switchValue={darkMode}
|
|
76
|
+
onSwitchChange={setDarkMode}
|
|
77
|
+
/>
|
|
78
|
+
</SettingsSection>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Props
|
|
84
|
+
|
|
85
|
+
### SettingsSectionProps
|
|
86
|
+
|
|
87
|
+
| Prop | Type | Default | Description |
|
|
88
|
+
|------|------|---------|-------------|
|
|
89
|
+
| `title` | `string` | `undefined` | Section title |
|
|
90
|
+
| `children` | `ReactNode` | **Required** | Section content |
|
|
91
|
+
| `style` | `ViewStyle` | `undefined` | Custom container style |
|
|
92
|
+
| `titleStyle` | `TextStyle` | `undefined` | Custom title style |
|
|
93
|
+
| `showTitle` | `boolean` | `true` | Show/hide title |
|
|
94
|
+
| `containerStyle` | `ViewStyle` | `undefined` | Content container style |
|
|
95
|
+
| `testID` | `string` | `undefined` | Test identifier |
|
|
96
|
+
|
|
97
|
+
## Component Structure
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
SettingsSection
|
|
101
|
+
├── Section Header (if title provided)
|
|
102
|
+
│ └── Title Text
|
|
103
|
+
└── Content Container
|
|
104
|
+
└── Children (SettingsItemCard components)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Multiple Sections
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
function SettingsScreen() {
|
|
113
|
+
return (
|
|
114
|
+
<ScrollView>
|
|
115
|
+
<SettingsSection title="GENERAL">
|
|
116
|
+
<SettingsItemCard icon="person-outline" title="Profile" onPress={() => {}} />
|
|
117
|
+
<SettingsItemCard icon="notifications-outline" title="Notifications" onPress={() => {}} />
|
|
118
|
+
</SettingsSection>
|
|
119
|
+
|
|
120
|
+
<SettingsSection title="APPEARANCE">
|
|
121
|
+
<SettingsItemCard icon="moon-outline" title="Dark Mode" onPress={() => {}} />
|
|
122
|
+
<SettingsItemCard icon="color-palette-outline" title="Theme" onPress={() => {}} />
|
|
123
|
+
</SettingsSection>
|
|
124
|
+
|
|
125
|
+
<SettingsSection title="PRIVACY">
|
|
126
|
+
<SettingsItemCard icon="shield-outline" title="Privacy" onPress={() => {}} />
|
|
127
|
+
<SettingsItemCard icon="lock-closed-outline" title="Security" onPress={() => {}} />
|
|
128
|
+
</SettingsSection>
|
|
129
|
+
</ScrollView>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### With Header Customization
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
function CustomHeaderSection() {
|
|
138
|
+
return (
|
|
139
|
+
<SettingsSection
|
|
140
|
+
title="PREFERENCES"
|
|
141
|
+
titleStyle={{
|
|
142
|
+
fontSize: 12,
|
|
143
|
+
fontWeight: '700',
|
|
144
|
+
color: '#2196F3',
|
|
145
|
+
letterSpacing: 1,
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<SettingsItemCard
|
|
149
|
+
icon="globe-outline"
|
|
150
|
+
title="Language"
|
|
151
|
+
subtitle="English"
|
|
152
|
+
onPress={() => {}}
|
|
153
|
+
/>
|
|
154
|
+
</SettingsSection>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### With Custom Spacing
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
function SpacedSection() {
|
|
163
|
+
return (
|
|
164
|
+
<SettingsSection
|
|
165
|
+
title="SETTINGS"
|
|
166
|
+
style={{ marginBottom: 20 }}
|
|
167
|
+
containerStyle={{ gap: 10 }}
|
|
168
|
+
>
|
|
169
|
+
<SettingsItemCard icon="cog-outline" title="Settings" onPress={() => {}} />
|
|
170
|
+
<SettingsItemCard icon="apps-outline" title="Apps" onPress={() => {}} />
|
|
171
|
+
</SettingsSection>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Nested Content
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
function NestedContentSection() {
|
|
180
|
+
return (
|
|
181
|
+
<SettingsSection title="ADVANCED">
|
|
182
|
+
<View>
|
|
183
|
+
<Text style={styles.heading}>Display Options</Text>
|
|
184
|
+
<SettingsItemCard
|
|
185
|
+
icon="eye-outline"
|
|
186
|
+
title="Show Preview"
|
|
187
|
+
showSwitch={true}
|
|
188
|
+
switchValue={showPreview}
|
|
189
|
+
onSwitchChange={setShowPreview}
|
|
190
|
+
/>
|
|
191
|
+
</View>
|
|
192
|
+
|
|
193
|
+
<View>
|
|
194
|
+
<Text style={styles.heading}>Storage</Text>
|
|
195
|
+
<SettingsItemCard
|
|
196
|
+
icon="trash-outline"
|
|
197
|
+
title="Clear Cache"
|
|
198
|
+
onPress={() => {}}
|
|
199
|
+
/>
|
|
200
|
+
</View>
|
|
201
|
+
</SettingsSection>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Conditional Items
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
function ConditionalSection() {
|
|
210
|
+
const isPro = useIsProUser();
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<SettingsSection title="PREMIUM">
|
|
214
|
+
<SettingsItemCard
|
|
215
|
+
icon="star-outline"
|
|
216
|
+
title="Upgrade to Pro"
|
|
217
|
+
subtitle="Get all premium features"
|
|
218
|
+
onPress={() => {}}
|
|
219
|
+
/>
|
|
220
|
+
|
|
221
|
+
{isPro && (
|
|
222
|
+
<SettingsItemCard
|
|
223
|
+
icon="diamond-outline"
|
|
224
|
+
title="Pro Features"
|
|
225
|
+
subtitle="Manage your subscription"
|
|
226
|
+
onPress={() => {}}
|
|
227
|
+
/>
|
|
228
|
+
)}
|
|
229
|
+
|
|
230
|
+
{isPro && (
|
|
231
|
+
<SettingsItemCard
|
|
232
|
+
icon="card-outline"
|
|
233
|
+
title="Billing"
|
|
234
|
+
onPress={() => {}}
|
|
235
|
+
/>
|
|
236
|
+
)}
|
|
237
|
+
</SettingsSection>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Styling
|
|
243
|
+
|
|
244
|
+
### Default Styles
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const styles = StyleSheet.create({
|
|
248
|
+
container: {
|
|
249
|
+
marginTop: tokens.spacing.lg,
|
|
250
|
+
},
|
|
251
|
+
title: {
|
|
252
|
+
fontSize: tokens.typography.fontSize.xs,
|
|
253
|
+
fontWeight: '700',
|
|
254
|
+
color: tokens.colors.textSecondary,
|
|
255
|
+
textTransform: 'uppercase',
|
|
256
|
+
letterSpacing: 0.5,
|
|
257
|
+
marginLeft: tokens.spacing.xl,
|
|
258
|
+
marginBottom: tokens.spacing.sm,
|
|
259
|
+
},
|
|
260
|
+
content: {
|
|
261
|
+
// No additional styling by default
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Custom Section Styles
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
<SettingsSection
|
|
270
|
+
title="CUSTOM"
|
|
271
|
+
style={{
|
|
272
|
+
backgroundColor: '#fff',
|
|
273
|
+
padding: 10,
|
|
274
|
+
borderRadius: 10,
|
|
275
|
+
margin: 15,
|
|
276
|
+
}}
|
|
277
|
+
titleStyle={{
|
|
278
|
+
color: '#FF5722',
|
|
279
|
+
fontSize: 14,
|
|
280
|
+
fontWeight: 'bold',
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
{/* Content */}
|
|
284
|
+
</SettingsSection>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Section Variants
|
|
288
|
+
|
|
289
|
+
#### Compact Section
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
<SettingsSection
|
|
293
|
+
title="QUICK SETTINGS"
|
|
294
|
+
style={{ marginTop: tokens.spacing.sm }}
|
|
295
|
+
>
|
|
296
|
+
{/* Items */}
|
|
297
|
+
</SettingsSection>
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
#### Spaced Section
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
<SettingsSection
|
|
304
|
+
title="SETTINGS"
|
|
305
|
+
style={{ marginTop: tokens.spacing.xl }}
|
|
306
|
+
>
|
|
307
|
+
{/* Items */}
|
|
308
|
+
</SettingsSection>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### Full Width Section
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
<SettingsSection
|
|
315
|
+
title="FULL WIDTH"
|
|
316
|
+
style={{ marginHorizontal: 0 }}
|
|
317
|
+
titleStyle={{ marginLeft: tokens.spacing.lg }}
|
|
318
|
+
>
|
|
319
|
+
{/* Items */}
|
|
320
|
+
</SettingsSection>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Layout Integration
|
|
324
|
+
|
|
325
|
+
### In ScrollView
|
|
326
|
+
|
|
327
|
+
```tsx
|
|
328
|
+
function SettingsScreen() {
|
|
329
|
+
return (
|
|
330
|
+
<ScrollView style={styles.scrollView}>
|
|
331
|
+
<SettingsSection title="GENERAL">
|
|
332
|
+
<SettingsItemCard icon="person-outline" title="Profile" onPress={() => {}} />
|
|
333
|
+
<SettingsItemCard icon="notifications-outline" title="Notifications" onPress={() => {}} />
|
|
334
|
+
</SettingsSection>
|
|
335
|
+
|
|
336
|
+
<SettingsSection title="APPEARANCE">
|
|
337
|
+
<SettingsItemCard icon="moon-outline" title="Dark Mode" onPress={() => {}} />
|
|
338
|
+
</SettingsSection>
|
|
339
|
+
</ScrollView>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### In FlatList
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
function SettingsScreen() {
|
|
348
|
+
const sections = [
|
|
349
|
+
{
|
|
350
|
+
title: 'GENERAL',
|
|
351
|
+
data: [
|
|
352
|
+
{ id: '1', title: 'Profile', icon: 'person-outline' },
|
|
353
|
+
{ id: '2', title: 'Notifications', icon: 'notifications-outline' },
|
|
354
|
+
],
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
title: 'APPEARANCE',
|
|
358
|
+
data: [
|
|
359
|
+
{ id: '3', title: 'Dark Mode', icon: 'moon-outline' },
|
|
360
|
+
],
|
|
361
|
+
},
|
|
362
|
+
];
|
|
363
|
+
|
|
364
|
+
const renderSectionHeader = ({ section }) => (
|
|
365
|
+
<SettingsSection title={section.title}>
|
|
366
|
+
{section.data.map((item) => (
|
|
367
|
+
<SettingsItemCard
|
|
368
|
+
key={item.id}
|
|
369
|
+
icon={item.icon}
|
|
370
|
+
title={item.title}
|
|
371
|
+
onPress={() => {}}
|
|
372
|
+
/>
|
|
373
|
+
))}
|
|
374
|
+
</SettingsSection>
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
return (
|
|
378
|
+
<SectionList
|
|
379
|
+
sections={sections}
|
|
380
|
+
renderSectionHeader={renderSectionHeader}
|
|
381
|
+
keyExtractor={(item) => item.id}
|
|
382
|
+
/>
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Best Practices
|
|
388
|
+
|
|
389
|
+
1. **Logical Grouping**: Group related settings together
|
|
390
|
+
2. **Clear Titles**: Use descriptive, concise section titles
|
|
391
|
+
3. **Consistent Spacing**: Maintain consistent spacing between sections
|
|
392
|
+
4. **Order**: Order sections by importance or frequency of use
|
|
393
|
+
5. **Limit Items**: Keep sections focused (3-6 items max)
|
|
394
|
+
6. **Accessibility**: Ensure sections are accessible
|
|
395
|
+
7. **Styling**: Use design system tokens for consistency
|
|
396
|
+
|
|
397
|
+
## Section Title Guidelines
|
|
398
|
+
|
|
399
|
+
### Good Titles
|
|
400
|
+
|
|
401
|
+
- ✅ "GENERAL" - Clear and concise
|
|
402
|
+
- ✅ "APPEARANCE" - Descriptive
|
|
403
|
+
- ✅ "NOTIFICATIONS" - Specific
|
|
404
|
+
- ✅ "PRIVACY & SECURITY" - Combined topics
|
|
405
|
+
|
|
406
|
+
### Avoid
|
|
407
|
+
|
|
408
|
+
- ❌ "Settings" - Too generic
|
|
409
|
+
- ❌ "Stuff" - Not descriptive
|
|
410
|
+
- ❌ "Misc" - Vague
|
|
411
|
+
- ❌ "Other" - Unclear
|
|
412
|
+
|
|
413
|
+
## Related
|
|
414
|
+
|
|
415
|
+
- **SettingsItemCard**: Individual item component
|
|
416
|
+
- **SettingsContent**: Content composer
|
|
417
|
+
- **SettingsScreen**: Main screen component
|
|
418
|
+
|
|
419
|
+
## License
|
|
420
|
+
|
|
421
|
+
MIT
|