@umituz/react-native-settings 4.20.58 → 4.20.60
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/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 +95 -489
- 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 -436
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +152 -391
- 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/SettingsStackNavigator.tsx +2 -0
- package/src/presentation/navigation/components/README.md +70 -295
- package/src/presentation/navigation/components/wrappers/SettingsScreenWrapper.tsx +3 -0
- package/src/presentation/navigation/hooks/README.md +75 -367
- package/src/presentation/navigation/types.ts +1 -0
- package/src/presentation/navigation/utils/README.md +100 -380
- package/src/presentation/screens/README.md +53 -504
- package/src/presentation/screens/SettingsScreen.tsx +4 -2
- 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,589 +1,100 @@
|
|
|
1
1
|
# Appearance Domain
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
mode: 'dark',
|
|
99
|
-
title: 'Dark Mode',
|
|
100
|
-
subtitle: 'Easy on the eyes',
|
|
101
|
-
description: 'Great for low-light environments',
|
|
102
|
-
features: ['Reduces eye strain', 'Saves battery'],
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<ThemeModeSection
|
|
108
|
-
themeMode="dark"
|
|
109
|
-
onThemeSelect={(mode) => console.log('Selected:', mode)}
|
|
110
|
-
title="Choose Theme"
|
|
111
|
-
description="Select your preferred theme"
|
|
112
|
-
themes={themes}
|
|
113
|
-
/>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### Props
|
|
119
|
-
|
|
120
|
-
| Prop | Type | Default | Description |
|
|
121
|
-
|------|------|---------|-------------|
|
|
122
|
-
| `tokens` | `DesignTokens` | **Required** | Design tokens from design system |
|
|
123
|
-
| `themeMode` | `ThemeMode` | **Required** | Current theme mode |
|
|
124
|
-
| `onThemeSelect` | `(mode) => void` | **Required** | Theme change handler |
|
|
125
|
-
| `title` | `string` | `undefined` | Section title |
|
|
126
|
-
| `description` | `string` | `undefined` | Section description |
|
|
127
|
-
| `themes` | `ThemeOptionConfig[]` | **Required** | Available theme options |
|
|
128
|
-
|
|
129
|
-
### CustomColorsSection
|
|
130
|
-
|
|
131
|
-
Section for customizing app colors.
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
import { CustomColorsSection } from '@umituz/react-native-settings';
|
|
135
|
-
|
|
136
|
-
function ColorsSection() {
|
|
137
|
-
const customColors = {
|
|
138
|
-
primary: '#007AFF',
|
|
139
|
-
secondary: '#5856D6',
|
|
140
|
-
accent: '#FF9500',
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<CustomColorsSection
|
|
145
|
-
localCustomColors={customColors}
|
|
146
|
-
onColorChange={(key, color) => console.log(`${key}: ${color}`)}
|
|
147
|
-
onResetColors={() => console.log('Reset colors')}
|
|
148
|
-
title="Custom Colors"
|
|
149
|
-
description="Personalize your color scheme"
|
|
150
|
-
resetButtonText="Reset"
|
|
151
|
-
/>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### Props
|
|
157
|
-
|
|
158
|
-
| Prop | Type | Default | Description |
|
|
159
|
-
|------|------|---------|-------------|
|
|
160
|
-
| `tokens` | `DesignTokens` | **Required** | Design tokens from design system |
|
|
161
|
-
| `localCustomColors` | `CustomThemeColors` | **Required** | Current custom colors |
|
|
162
|
-
| `onColorChange` | `(key, color) => void` | **Required** | Color change handler |
|
|
163
|
-
| `onResetColors` | `() => void` | **Required** | Reset handler |
|
|
164
|
-
| `title` | `string` | `undefined` | Section title |
|
|
165
|
-
| `description` | `string` | `undefined` | Section description |
|
|
166
|
-
| `resetButtonText` | `string` | `undefined` | Reset button text |
|
|
167
|
-
|
|
168
|
-
### AppearancePreview
|
|
169
|
-
|
|
170
|
-
Live preview component showing how theme changes look.
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
import { AppearancePreview } from '@umituz/react-native-settings';
|
|
174
|
-
|
|
175
|
-
function PreviewSection() {
|
|
176
|
-
const customColors = {
|
|
177
|
-
primary: '#007AFF',
|
|
178
|
-
secondary: '#5856D6',
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<AppearancePreview
|
|
183
|
-
localCustomColors={customColors}
|
|
184
|
-
title="Preview"
|
|
185
|
-
description="See how your changes look in real-time"
|
|
186
|
-
/>
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
#### Props
|
|
192
|
-
|
|
193
|
-
| Prop | Type | Default | Description |
|
|
194
|
-
|------|------|---------|-------------|
|
|
195
|
-
| `tokens` | `DesignTokens` | **Required** | Design tokens from design system |
|
|
196
|
-
| `localCustomColors` | `CustomThemeColors` | **Required** | Custom colors to preview |
|
|
197
|
-
| `title` | `string` | `undefined` | Section title |
|
|
198
|
-
| `description` | `string` | `undefined` | Section description |
|
|
199
|
-
|
|
200
|
-
### ColorPicker
|
|
201
|
-
|
|
202
|
-
Color picker component for selecting custom colors.
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
import { ColorPicker } from '@umituz/react-native-settings';
|
|
206
|
-
|
|
207
|
-
function MyColorPicker() {
|
|
208
|
-
return (
|
|
209
|
-
<ColorPicker
|
|
210
|
-
label="Primary Color"
|
|
211
|
-
value="#007AFF"
|
|
212
|
-
onChange={(color) => console.log('Color:', color)}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### AppearanceHeader
|
|
219
|
-
|
|
220
|
-
Header component for the appearance screen.
|
|
221
|
-
|
|
222
|
-
```tsx
|
|
223
|
-
import { AppearanceHeader } from '@umituz/react-native-settings';
|
|
224
|
-
|
|
225
|
-
function MyAppearanceHeader() {
|
|
226
|
-
const tokens = useAppDesignTokens();
|
|
227
|
-
|
|
228
|
-
return (
|
|
229
|
-
<AppearanceHeader
|
|
230
|
-
tokens={tokens}
|
|
231
|
-
title="Appearance"
|
|
232
|
-
subtitle="Customize your app"
|
|
233
|
-
/>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### Props
|
|
239
|
-
|
|
240
|
-
| Prop | Type | Default | Description |
|
|
241
|
-
|------|------|---------|-------------|
|
|
242
|
-
| `tokens` | `DesignTokens` | **Required** | Design tokens |
|
|
243
|
-
| `title` | `string` | `undefined` | Header title |
|
|
244
|
-
| `subtitle` | `string` | `undefined` | Header subtitle |
|
|
245
|
-
|
|
246
|
-
## Hooks
|
|
247
|
-
|
|
248
|
-
### useAppearance
|
|
249
|
-
|
|
250
|
-
Main hook for accessing and managing appearance settings.
|
|
251
|
-
|
|
252
|
-
```tsx
|
|
253
|
-
import { useAppearance } from '@umituz/react-native-settings';
|
|
254
|
-
|
|
255
|
-
function MyComponent() {
|
|
256
|
-
const {
|
|
257
|
-
themeMode,
|
|
258
|
-
customColors,
|
|
259
|
-
isLoading,
|
|
260
|
-
setThemeMode,
|
|
261
|
-
setCustomColors,
|
|
262
|
-
reset,
|
|
263
|
-
} = useAppearance();
|
|
264
|
-
|
|
265
|
-
return (
|
|
266
|
-
<View>
|
|
267
|
-
<Text>Current theme: {themeMode}</Text>
|
|
268
|
-
<Button title="Switch to Dark" onPress={() => setThemeMode('dark')} />
|
|
269
|
-
<Button title="Reset" onPress={reset} />
|
|
270
|
-
</View>
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
#### Return Value
|
|
276
|
-
|
|
277
|
-
| Property | Type | Description |
|
|
278
|
-
|----------|------|-------------|
|
|
279
|
-
| `themeMode` | `ThemeMode` | Current theme mode (`'light'` or `'dark'`) |
|
|
280
|
-
| `customColors` | `CustomThemeColors \| undefined` | Custom color scheme |
|
|
281
|
-
| `isLoading` | `boolean` | Loading state |
|
|
282
|
-
| `setThemeMode` | `(mode) => void` | Function to set theme mode |
|
|
283
|
-
| `setCustomColors` | `(colors) => void` | Function to set custom colors |
|
|
284
|
-
| `reset` | `() => void` | Reset to default appearance |
|
|
285
|
-
|
|
286
|
-
### useAppearanceActions
|
|
287
|
-
|
|
288
|
-
Hook for appearance-related actions and handlers.
|
|
289
|
-
|
|
290
|
-
```tsx
|
|
291
|
-
import { useAppearanceActions } from '@umituz/react-native-settings';
|
|
292
|
-
|
|
293
|
-
function AppearanceActions() {
|
|
294
|
-
const {
|
|
295
|
-
localCustomColors,
|
|
296
|
-
handleThemeSelect,
|
|
297
|
-
handleColorChange,
|
|
298
|
-
handleResetColors,
|
|
299
|
-
} = useAppearanceActions();
|
|
300
|
-
|
|
301
|
-
return (
|
|
302
|
-
<View>
|
|
303
|
-
<Button
|
|
304
|
-
title="Select Dark Theme"
|
|
305
|
-
onPress={() => handleThemeSelect('dark')}
|
|
306
|
-
/>
|
|
307
|
-
<Button
|
|
308
|
-
title="Change Primary Color"
|
|
309
|
-
onPress={() => handleColorChange('primary', '#FF0000')}
|
|
310
|
-
/>
|
|
311
|
-
<Button title="Reset Colors" onPress={handleResetColors} />
|
|
312
|
-
</View>
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
#### Return Value
|
|
318
|
-
|
|
319
|
-
| Property | Type | Description |
|
|
320
|
-
|----------|------|-------------|
|
|
321
|
-
| `localCustomColors` | `CustomThemeColors` | Current custom colors |
|
|
322
|
-
| `handleThemeSelect` | `(mode) => void` | Handle theme selection |
|
|
323
|
-
| `handleColorChange` | `(key, color) => void` | Handle color change |
|
|
324
|
-
| `handleResetColors` | `() => void` | Handle color reset |
|
|
325
|
-
|
|
326
|
-
## Types
|
|
327
|
-
|
|
328
|
-
### ThemeMode
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
type ThemeMode = 'light' | 'dark';
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### CustomThemeColors
|
|
335
|
-
|
|
336
|
-
```typescript
|
|
337
|
-
interface CustomThemeColors {
|
|
338
|
-
primary?: string;
|
|
339
|
-
secondary?: string;
|
|
340
|
-
accent?: string;
|
|
341
|
-
background?: string;
|
|
342
|
-
surface?: string;
|
|
343
|
-
// ... more color options
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### AppearanceSettings
|
|
348
|
-
|
|
349
|
-
```typescript
|
|
350
|
-
interface AppearanceSettings {
|
|
351
|
-
themeMode: ThemeMode;
|
|
352
|
-
customColors?: CustomThemeColors;
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
### AppearanceTexts
|
|
357
|
-
|
|
358
|
-
```typescript
|
|
359
|
-
interface AppearanceTexts {
|
|
360
|
-
title?: string;
|
|
361
|
-
subtitle?: string;
|
|
362
|
-
themeSectionTitle?: string;
|
|
363
|
-
themeSectionDescription?: string;
|
|
364
|
-
featuresSectionTitle?: string;
|
|
365
|
-
colorsSectionTitle?: string;
|
|
366
|
-
colorsSectionDescription?: string;
|
|
367
|
-
previewSectionTitle?: string;
|
|
368
|
-
previewSectionDescription?: string;
|
|
369
|
-
resetButtonText?: string;
|
|
370
|
-
lightMode?: ThemeModeTextConfig;
|
|
371
|
-
darkMode?: ThemeModeTextConfig;
|
|
372
|
-
}
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
### ThemeModeTextConfig
|
|
376
|
-
|
|
377
|
-
```typescript
|
|
378
|
-
interface ThemeModeTextConfig {
|
|
379
|
-
title: string;
|
|
380
|
-
subtitle?: string;
|
|
381
|
-
description?: string;
|
|
382
|
-
features: string[];
|
|
383
|
-
}
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### ThemeOptionConfig
|
|
387
|
-
|
|
388
|
-
```typescript
|
|
389
|
-
interface ThemeOptionConfig {
|
|
390
|
-
mode: ThemeMode;
|
|
391
|
-
title: string;
|
|
392
|
-
subtitle?: string;
|
|
393
|
-
description?: string;
|
|
394
|
-
features?: string[];
|
|
395
|
-
featuresTitle?: string;
|
|
396
|
-
}
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
## Examples
|
|
400
|
-
|
|
401
|
-
### Basic Usage
|
|
402
|
-
|
|
403
|
-
```tsx
|
|
404
|
-
import React from 'react';
|
|
405
|
-
import { View } from 'react-native';
|
|
406
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
407
|
-
|
|
408
|
-
export default function App() {
|
|
409
|
-
return (
|
|
410
|
-
<View style={{ flex: 1 }}>
|
|
411
|
-
<AppearanceScreen />
|
|
412
|
-
</View>
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Custom Sections
|
|
418
|
-
|
|
419
|
-
```tsx
|
|
420
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
421
|
-
|
|
422
|
-
function CustomAppearanceScreen() {
|
|
423
|
-
return (
|
|
424
|
-
<AppearanceScreen
|
|
425
|
-
showThemeSection={true}
|
|
426
|
-
showColorsSection={false} // Hide color customization
|
|
427
|
-
showPreviewSection={true}
|
|
428
|
-
/>
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
### Using the Hook
|
|
434
|
-
|
|
435
|
-
```tsx
|
|
436
|
-
import { useAppearance } from '@umituz/react-native-settings';
|
|
437
|
-
|
|
438
|
-
function ThemeToggle() {
|
|
439
|
-
const { themeMode, setThemeMode } = useAppearance();
|
|
440
|
-
|
|
441
|
-
return (
|
|
442
|
-
<View>
|
|
443
|
-
<Text>Current: {themeMode}</Text>
|
|
444
|
-
<Button
|
|
445
|
-
title="Toggle Theme"
|
|
446
|
-
onPress={() => setThemeMode(themeMode === 'light' ? 'dark' : 'light')}
|
|
447
|
-
/>
|
|
448
|
-
</View>
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### Custom Colors
|
|
454
|
-
|
|
455
|
-
```tsx
|
|
456
|
-
import { useAppearance } from '@umituz/react-native-settings';
|
|
457
|
-
|
|
458
|
-
function ColorCustomizer() {
|
|
459
|
-
const { customColors, setCustomColors } = useAppearance();
|
|
460
|
-
|
|
461
|
-
const applyCustomTheme = () => {
|
|
462
|
-
setCustomColors({
|
|
463
|
-
primary: '#FF6B6B',
|
|
464
|
-
secondary: '#4ECDC4',
|
|
465
|
-
accent: '#FFE66D',
|
|
466
|
-
});
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
return (
|
|
470
|
-
<View>
|
|
471
|
-
<Text>Primary: {customColors?.primary}</Text>
|
|
472
|
-
<Button title="Apply Custom Theme" onPress={applyCustomTheme} />
|
|
473
|
-
</View>
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### Complete Customization
|
|
479
|
-
|
|
480
|
-
```tsx
|
|
481
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
482
|
-
|
|
483
|
-
function FullyCustomizedScreen() {
|
|
484
|
-
const texts = {
|
|
485
|
-
title: 'Personalization',
|
|
486
|
-
subtitle: 'Make it yours',
|
|
487
|
-
themeSectionTitle: 'Theme Mode',
|
|
488
|
-
colorsSectionTitle: 'Color Palette',
|
|
489
|
-
resetButtonText: 'Reset Everything',
|
|
490
|
-
lightMode: {
|
|
491
|
-
title: 'Light',
|
|
492
|
-
features: ['Clean look', 'Better readability'],
|
|
493
|
-
},
|
|
494
|
-
darkMode: {
|
|
495
|
-
title: 'Dark',
|
|
496
|
-
features: ['Easy on eyes', 'Saves battery'],
|
|
497
|
-
},
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
const customHeader = (
|
|
501
|
-
<View style={{ padding: 20 }}>
|
|
502
|
-
<Text style={{ fontSize: 24, fontWeight: 'bold' }}>
|
|
503
|
-
App Settings
|
|
504
|
-
</Text>
|
|
505
|
-
</View>
|
|
506
|
-
);
|
|
507
|
-
|
|
508
|
-
return (
|
|
509
|
-
<AppearanceScreen
|
|
510
|
-
texts={texts}
|
|
511
|
-
headerComponent={customHeader}
|
|
512
|
-
showPreviewSection={false}
|
|
513
|
-
/>
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
## Architecture
|
|
519
|
-
|
|
520
|
-
The Appearance domain follows a clean architecture pattern:
|
|
521
|
-
|
|
522
|
-
```
|
|
523
|
-
src/domains/appearance/
|
|
524
|
-
├── application/ # Application logic
|
|
525
|
-
│ └── ports/ # Repository interfaces
|
|
526
|
-
├── infrastructure/ # Implementation
|
|
527
|
-
│ ├── repositories/ # Data persistence
|
|
528
|
-
│ └── services/ # System theme detection, validation
|
|
529
|
-
├── presentation/ # UI components
|
|
530
|
-
│ ├── screens/ # AppearanceScreen
|
|
531
|
-
│ ├── components/ # ThemeModeSection, CustomColorsSection, etc.
|
|
532
|
-
│ └── hooks/ # useAppearance, useAppearanceActions
|
|
533
|
-
├── data/ # Color palettes and constants
|
|
534
|
-
└── types/ # TypeScript definitions
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
## Best Practices
|
|
538
|
-
|
|
539
|
-
1. **Respect System Theme**: Detect and respect the user's device theme preference
|
|
540
|
-
2. **Provide Preview**: Always show users how changes look before applying
|
|
541
|
-
3. **Smooth Transitions**: Animate theme changes for a polished experience
|
|
542
|
-
4. **Persist Choices**: Save theme preferences automatically
|
|
543
|
-
5. **Accessibility First**: Ensure good contrast ratios in both themes
|
|
544
|
-
6. **Test Both Themes**: Verify your UI looks good in light and dark modes
|
|
545
|
-
|
|
546
|
-
## Testing
|
|
547
|
-
|
|
548
|
-
```tsx
|
|
549
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
550
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
551
|
-
|
|
552
|
-
describe('AppearanceScreen', () => {
|
|
553
|
-
it('displays theme options', () => {
|
|
554
|
-
const { getByText } = render(<AppearanceScreen />);
|
|
555
|
-
|
|
556
|
-
expect(getByText(/light/i)).toBeTruthy();
|
|
557
|
-
expect(getByText(/dark/i)).toBeTruthy();
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
it('handles theme selection', () => {
|
|
561
|
-
const { getByText } = render(<AppearanceScreen />);
|
|
562
|
-
|
|
563
|
-
const darkButton = getByText(/dark/i);
|
|
564
|
-
fireEvent.press(darkButton);
|
|
565
|
-
|
|
566
|
-
// Assert theme changed
|
|
567
|
-
});
|
|
568
|
-
});
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
## Integration with Design System
|
|
572
|
-
|
|
573
|
-
This domain integrates seamlessly with `@umituz/react-native-design-system`:
|
|
574
|
-
|
|
575
|
-
```tsx
|
|
576
|
-
import { useAppDesignTokens, ThemeProvider } from '@umituz/react-native-design-system';
|
|
577
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
578
|
-
|
|
579
|
-
function App() {
|
|
580
|
-
return (
|
|
581
|
-
<ThemeProvider>
|
|
582
|
-
<AppearanceScreen />
|
|
583
|
-
</ThemeProvider>
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
```
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Provides comprehensive theme management and customization capabilities including light/dark mode switching and custom color schemes.
|
|
6
|
+
|
|
7
|
+
## File Paths
|
|
8
|
+
|
|
9
|
+
**Screens:**
|
|
10
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/screens/AppearanceScreen.tsx`
|
|
11
|
+
|
|
12
|
+
**Components:**
|
|
13
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/components/ThemeModeSection.tsx`
|
|
14
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/components/CustomColorsSection.tsx`
|
|
15
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/components/AppearancePreview.tsx`
|
|
16
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/components/AppearanceHeader.tsx`
|
|
17
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/components/ColorPicker.tsx`
|
|
18
|
+
|
|
19
|
+
**Hooks:**
|
|
20
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/hooks/useAppearance.ts`
|
|
21
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/presentation/hooks/useAppearanceActions.ts`
|
|
22
|
+
|
|
23
|
+
**Application Layer:**
|
|
24
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/application/ports/IAppearanceRepository.ts`
|
|
25
|
+
|
|
26
|
+
**Infrastructure:**
|
|
27
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/infrastructure/repositories/AppearanceRepository.ts`
|
|
28
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/infrastructure/services/AppearanceValidationService.ts`
|
|
29
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/infrastructure/services/SystemThemeService.ts`
|
|
30
|
+
|
|
31
|
+
**Data:**
|
|
32
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/data/colorPalettes.ts`
|
|
33
|
+
|
|
34
|
+
**Types:**
|
|
35
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/types/index.ts`
|
|
36
|
+
|
|
37
|
+
**Index:**
|
|
38
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/index.ts`
|
|
39
|
+
|
|
40
|
+
## Strategy
|
|
41
|
+
|
|
42
|
+
1. **System Theme Detection**: Automatically detect and respect device theme preferences with SystemThemeService
|
|
43
|
+
2. **Repository Pattern**: Use IAppearanceRepository for abstracted theme data access and persistence
|
|
44
|
+
3. **Design System Integration**: Integrate with `@umituz/react-native-design-system` for consistent theming
|
|
45
|
+
4. **Color Validation**: Validate custom colors through AppearanceValidationService before applying
|
|
46
|
+
5. **Hook-Based State Management**: Use useAppearance and useAppearanceActions for theme state and actions
|
|
47
|
+
|
|
48
|
+
## Restrictions (Forbidden)
|
|
49
|
+
|
|
50
|
+
### DO NOT
|
|
51
|
+
- ❌ DO NOT bypass the repository pattern when accessing or updating theme data
|
|
52
|
+
- ❌ DO NOT apply custom colors without validation through AppearanceValidationService
|
|
53
|
+
- ❌ DO NOT use Appearance components without providing design tokens
|
|
54
|
+
- ❌ DO NOT hardcode theme values - always use the repository and hooks
|
|
55
|
+
|
|
56
|
+
### NEVER
|
|
57
|
+
- ❌ NEVER use theme values directly from storage without going through the repository
|
|
58
|
+
- ❌ NEVER apply colors that don't meet accessibility standards (contrast ratios)
|
|
59
|
+
- ❌ NEVER mutate theme state directly without using the provided hooks
|
|
60
|
+
- ❌ NEVER use AppearanceScreen without a ThemeProvider from the design system
|
|
61
|
+
|
|
62
|
+
### AVOID
|
|
63
|
+
- ❌ AVOID creating custom theme management solutions when the domain provides everything needed
|
|
64
|
+
- ❌ AVOID applying theme changes without smooth transitions
|
|
65
|
+
- ❌ AVOID storing invalid color values in the repository
|
|
66
|
+
- ❌ AVOID mixing theme logic with business logic in components
|
|
67
|
+
|
|
68
|
+
## Rules
|
|
69
|
+
|
|
70
|
+
### ALWAYS
|
|
71
|
+
- ✅ ALWAYS use useAppearance hook for theme state management
|
|
72
|
+
- ✅ ALWAYS validate custom colors before applying them
|
|
73
|
+
- ✅ ALWAYS provide design tokens to Appearance components
|
|
74
|
+
- ✅ ALWAYS wrap Appearance components in ThemeProvider from design system
|
|
75
|
+
- ✅ ALWAYS handle loading states when theme is being initialized
|
|
76
|
+
|
|
77
|
+
### MUST
|
|
78
|
+
- ✅ MUST use IAppearanceRepository interface for theme data access
|
|
79
|
+
- ✅ MUST persist theme changes immediately for next app launch
|
|
80
|
+
- ✅ MUST respect system theme when user hasn't set a preference
|
|
81
|
+
- ✅ MUST provide fallback colors when custom colors fail validation
|
|
82
|
+
- ✅ MUST test UI in both light and dark themes
|
|
83
|
+
|
|
84
|
+
### SHOULD
|
|
85
|
+
- ✅ SHOULD provide smooth transitions when theme changes
|
|
86
|
+
- ✅ SHOULD show preview of theme changes before applying
|
|
87
|
+
- ✅ SHOULD allow users to easily reset to default theme
|
|
88
|
+
- ✅ SHOULD implement theme changes with minimal re-renders
|
|
89
|
+
- ✅ SHOULD ensure good contrast ratios in both themes
|
|
90
|
+
|
|
91
|
+
## AI Agent Guidelines
|
|
92
|
+
|
|
93
|
+
1. **Design System Integration**: Always integrate Appearance components with ThemeProvider from `@umituz/react-native-design-system`
|
|
94
|
+
2. **Hook Usage**: Always use useAppearance for theme state and useAppearanceActions for theme operations
|
|
95
|
+
3. **Repository Access**: Always use IAppearanceRepository interface - never access storage directly
|
|
96
|
+
4. **Validation**: Always validate custom colors through AppearanceValidationService before applying
|
|
97
|
+
5. **Testing**: Always test appearance changes in both light and dark modes to ensure proper rendering
|
|
587
98
|
|
|
588
99
|
## Related
|
|
589
100
|
|