@umituz/react-native-settings 4.20.58 → 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.
Files changed (64) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
  2. package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
  5. package/AI_AGENT_GUIDELINES.md +367 -0
  6. package/ARCHITECTURE.md +246 -0
  7. package/CHANGELOG.md +67 -0
  8. package/CODE_OF_CONDUCT.md +75 -0
  9. package/CONTRIBUTING.md +107 -0
  10. package/DOCUMENTATION_MIGRATION.md +319 -0
  11. package/DOCUMENTATION_TEMPLATE.md +155 -0
  12. package/LICENSE +21 -0
  13. package/README.md +321 -498
  14. package/SECURITY.md +98 -0
  15. package/SETTINGS_SCREEN_GUIDE.md +185 -0
  16. package/TESTING.md +358 -0
  17. package/package.json +13 -2
  18. package/src/application/README.md +85 -271
  19. package/src/domains/about/README.md +85 -440
  20. package/src/domains/about/presentation/hooks/README.md +93 -348
  21. package/src/domains/appearance/README.md +95 -584
  22. package/src/domains/appearance/hooks/README.md +95 -303
  23. package/src/domains/appearance/infrastructure/services/README.md +83 -397
  24. package/src/domains/appearance/presentation/components/README.md +95 -489
  25. package/src/domains/cloud-sync/README.md +73 -439
  26. package/src/domains/cloud-sync/presentation/components/README.md +95 -493
  27. package/src/domains/dev/README.md +71 -457
  28. package/src/domains/disclaimer/README.md +77 -411
  29. package/src/domains/disclaimer/presentation/components/README.md +95 -392
  30. package/src/domains/faqs/README.md +86 -574
  31. package/src/domains/feedback/README.md +79 -553
  32. package/src/domains/feedback/presentation/hooks/README.md +93 -426
  33. package/src/domains/legal/README.md +88 -537
  34. package/src/domains/rating/README.md +73 -440
  35. package/src/domains/rating/presentation/components/README.md +95 -475
  36. package/src/domains/video-tutorials/README.md +77 -470
  37. package/src/domains/video-tutorials/presentation/components/README.md +95 -431
  38. package/src/infrastructure/README.md +78 -425
  39. package/src/infrastructure/repositories/README.md +88 -420
  40. package/src/infrastructure/services/README.md +74 -460
  41. package/src/presentation/components/README.md +97 -480
  42. package/src/presentation/components/SettingsErrorBoundary/README.md +48 -436
  43. package/src/presentation/components/SettingsFooter/README.md +48 -427
  44. package/src/presentation/components/SettingsItemCard/README.md +152 -391
  45. package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
  46. package/src/presentation/components/SettingsSection/README.md +47 -401
  47. package/src/presentation/hooks/README.md +95 -389
  48. package/src/presentation/hooks/mutations/README.md +99 -376
  49. package/src/presentation/hooks/queries/README.md +111 -353
  50. package/src/presentation/navigation/README.md +70 -502
  51. package/src/presentation/navigation/components/README.md +70 -295
  52. package/src/presentation/navigation/hooks/README.md +75 -367
  53. package/src/presentation/navigation/utils/README.md +100 -380
  54. package/src/presentation/screens/README.md +53 -504
  55. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  56. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  57. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  58. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  59. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  60. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  61. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  62. package/src/presentation/screens/hooks/README.md +64 -354
  63. package/src/presentation/screens/types/README.md +79 -409
  64. package/src/presentation/screens/utils/README.md +65 -255
@@ -2,345 +2,144 @@
2
2
 
3
3
  Custom hooks for managing appearance settings including theme mode and custom colors.
4
4
 
5
- ## Hooks
5
+ ## Purpose
6
6
 
7
- ### useAppearance
8
-
9
- Hook for accessing current appearance settings and theme mode.
10
-
11
- ```tsx
12
- import { useAppearance } from '@umituz/react-native-settings';
13
-
14
- function AppearanceScreen() {
15
- const { themeMode, customColors, isLoading } = useAppearance();
16
-
17
- return (
18
- <View>
19
- <Text>Current theme: {themeMode}</Text>
20
- {customColors && <Text>Custom colors enabled</Text>}
21
- </View>
22
- );
23
- }
24
- ```
25
-
26
- #### Returns
27
-
28
- ```typescript
29
- interface UseAppearanceResult {
30
- themeMode: 'light' | 'dark' | 'auto'; // Current theme mode
31
- customColors?: ColorPalette; // Custom color palette
32
- isLoading: boolean; // Loading state
33
- error?: Error; // Error object
34
- }
35
- ```
36
-
37
- #### Examples
38
-
39
- **Basic Usage:**
40
-
41
- ```tsx
42
- function ThemeDisplay() {
43
- const { themeMode } = useAppearance();
44
-
45
- return (
46
- <Text>Current theme: {themeMode}</Text>
47
- );
48
- }
49
- ```
50
-
51
- **With Loading State:**
52
-
53
- ```tsx
54
- function ThemeSelector() {
55
- const { themeMode, isLoading } = useAppearance();
56
-
57
- if (isLoading) {
58
- return <ActivityIndicator />;
59
- }
60
-
61
- return (
62
- <Picker selectedValue={themeMode}>
63
- <Picker.Item label="Light" value="light" />
64
- <Picker.Item label="Dark" value="dark" />
65
- <Picker.Item label="Auto" value="auto" />
66
- </Picker>
67
- );
68
- }
69
- ```
70
-
71
- **With Custom Colors:**
72
-
73
- ```tsx
74
- function ColorDisplay() {
75
- const { customColors } = useAppearance();
76
-
77
- return (
78
- <View>
79
- <View style={{ backgroundColor: customColors?.primary }} />
80
- <View style={{ backgroundColor: customColors?.secondary }} />
81
- <View style={{ backgroundColor: customColors?.accent }} />
82
- </View>
83
- );
84
- }
85
- ```
86
-
87
- ### useAppearanceActions
88
-
89
- Hook for accessing appearance action functions to update theme and colors.
7
+ Provides React hooks for accessing and manipulating appearance settings. These hooks bridge the UI layer with the appearance domain's business logic, offering a clean interface for theme management and color customization.
90
8
 
91
- ```tsx
92
- import { useAppearanceActions } from '@umituz/react-native-settings';
9
+ ## File Paths
93
10
 
94
- function AppearanceControls() {
95
- const { setThemeMode, setCustomColors, resetColors } = useAppearanceActions();
96
-
97
- const handleThemeChange = (theme: 'light' | 'dark') => {
98
- setThemeMode(theme);
99
- };
100
-
101
- const handleSetColors = (colors: ColorPalette) => {
102
- setCustomColors(colors);
103
- };
104
-
105
- const handleReset = () => {
106
- resetColors();
107
- };
108
-
109
- return (
110
- <View>
111
- <Button onPress={() => handleThemeChange('dark')} title="Dark Mode" />
112
- <Button onPress={() => handleSetColors(newColors)} title="Set Colors" />
113
- <Button onPress={handleReset} title="Reset Colors" />
114
- </View>
115
- );
116
- }
117
11
  ```
118
-
119
- #### Returns
120
-
121
- ```typescript
122
- interface UseAppearanceActionsResult {
123
- setThemeMode: (themeMode: 'light' | 'dark' | 'auto') => void;
124
- setCustomColors: (colors: ColorPalette) => void;
125
- resetColors: () => void;
126
- isUpdating: boolean;
127
- }
12
+ src/domains/appearance/hooks/
13
+ ├── useAppearance.ts # Access appearance settings
14
+ └── useAppearanceActions.ts # Modify appearance settings
128
15
  ```
129
16
 
130
- #### Actions
17
+ ## Strategy
131
18
 
132
- **setThemeMode:**
19
+ 1. **Separation of Concerns**: Split read operations (useAppearance) from write operations (useAppearanceActions)
20
+ 2. **Automatic Persistence**: All changes are automatically persisted without manual save operations
21
+ 3. **Type Safety**: Strongly typed theme modes and color palettes
22
+ 4. **System Integration**: Respect system theme preferences when in auto mode
23
+ 5. **Reactive Updates**: Automatically trigger re-renders when appearance changes
133
24
 
134
- Sets the theme mode.
25
+ ## Restrictions
135
26
 
136
- ```tsx
137
- const { setThemeMode } = useAppearanceActions();
27
+ ### DO NOT
138
28
 
139
- // Set to dark mode
140
- setThemeMode('dark');
29
+ - DO NOT mix appearance hooks with direct settings manipulation
30
+ - ❌ DO NOT bypass validation when setting custom colors
31
+ - ❌ DO NOT assume theme mode is always the same as effective theme
32
+ - ❌ DO NOT manually manage persistence; hooks handle this automatically
33
+ - ❌ DO NOT create circular dependencies between appearance hooks
141
34
 
142
- // Set to light mode
143
- setThemeMode('light');
35
+ ### NEVER
144
36
 
145
- // Set to auto (system preference)
146
- setThemeMode('auto');
147
- ```
148
-
149
- **setCustomColors:**
150
-
151
- Sets custom color palette.
152
-
153
- ```tsx
154
- const { setCustomColors } = useAppearanceActions();
37
+ - NEVER call useAppearanceActions outside React components
38
+ - ❌ NEVER ignore loading states during appearance operations
39
+ - ❌ EVER hardcode color values; use the hooks instead
40
+ - ❌ EVER mutate theme state directly; use action hooks
155
41
 
156
- const colors = {
157
- primary: '#FF5722',
158
- secondary: '#2196F3',
159
- accent: '#FFC107',
160
- background: '#FFFFFF',
161
- surface: '#F5F5F5',
162
- };
42
+ ### AVOID
163
43
 
164
- setCustomColors(colors);
165
- ```
166
-
167
- **resetColors:**
44
+ - ❌ AVOID frequent theme changes without debouncing
45
+ - ❌ AVOID creating custom appearance logic outside these hooks
46
+ - ❌ AVOID inconsistent theme application across components
47
+ - ❌ AVOID ignoring system theme preferences in auto mode
168
48
 
169
- Resets to default colors.
49
+ ## Rules
170
50
 
171
- ```tsx
172
- const { resetColors } = useAppearanceActions();
51
+ ### ALWAYS
173
52
 
174
- resetColors();
175
- ```
53
+ - ✅ ALWAYS use useAppearance for reading appearance state
54
+ - ✅ ALWAYS use useAppearanceActions for modifying appearance
55
+ - ✅ ALWAYS validate color values before setting custom colors
56
+ - ✅ ALWAYS handle loading states during theme operations
57
+ - ✅ ALWAYS respect system theme when mode is 'auto'
176
58
 
177
- ## Complete Example
59
+ ### MUST
178
60
 
179
- ### Theme Switcher
61
+ - MUST apply theme changes consistently across the app
62
+ - ✅ MUST provide visual feedback for theme changes
63
+ - ✅ MUST handle errors in color validation gracefully
64
+ - ✅ MUST persist changes immediately
180
65
 
181
- ```tsx
182
- function ThemeSwitcher() {
183
- const { themeMode } = useAppearance();
184
- const { setThemeMode } = useAppearanceActions();
66
+ ### SHOULD
185
67
 
186
- return (
187
- <View>
188
- <Text>Current Theme: {themeMode}</Text>
68
+ - ✅ SHOULD use useMemo for expensive theme computations
69
+ - ✅ SHOULD provide smooth transitions between theme changes
70
+ - SHOULD offer reset functionality for custom colors
71
+ - ✅ SHOULD show live preview of appearance changes
189
72
 
190
- <TouchableOpacity onPress={() => setThemeMode('light')}>
191
- <Text>Light Mode</Text>
192
- </TouchableOpacity>
73
+ ## AI Agent Guidelines
193
74
 
194
- <TouchableOpacity onPress={() => setThemeMode('dark')}>
195
- <Text>Dark Mode</Text>
196
- </TouchableOpacity>
75
+ 1. **When creating custom appearance hooks**: Compose existing hooks rather than creating new ones
76
+ 2. **When adding new theme modes**: Extend the theme mode type and update all switch statements
77
+ 3. **When customizing colors**: Always validate hex format before applying
78
+ 4. **When integrating system theme**: Use useColorScheme for detecting system preferences
79
+ 5. **When debugging appearance**: Use React DevTools to inspect hook state and dependencies
197
80
 
198
- <TouchableOpacity onPress={() => setThemeMode('auto')}>
199
- <Text>Auto (System)</Text>
200
- </TouchableOpacity>
201
- </View>
202
- );
203
- }
204
- ```
81
+ ## Hooks Reference
205
82
 
206
- ### Color Customizer
207
-
208
- ```tsx
209
- function ColorCustomizer() {
210
- const { customColors } = useAppearance();
211
- const { setCustomColors, resetColors } = useAppearanceActions();
212
-
213
- const [colors, setColors] = useState(customColors || defaultColors);
214
-
215
- const handleSave = () => {
216
- setCustomColors(colors);
217
- };
218
-
219
- const handleReset = () => {
220
- resetColors();
221
- setColors(defaultColors);
222
- };
223
-
224
- return (
225
- <View>
226
- <ColorPicker
227
- label="Primary Color"
228
- value={colors.primary}
229
- onChange={(color) => setColors({ ...colors, primary: color })}
230
- />
231
-
232
- <ColorPicker
233
- label="Secondary Color"
234
- value={colors.secondary}
235
- onChange={(color) => setColors({ ...colors, secondary: color })}
236
- />
237
-
238
- <Button onPress={handleSave} title="Save Colors" />
239
- <Button onPress={handleReset} title="Reset to Default" />
240
- </View>
241
- );
242
- }
243
- ```
83
+ ### useAppearance
244
84
 
245
- ### Theme Toggle Button
246
-
247
- ```tsx
248
- function ThemeToggleButton() {
249
- const { themeMode } = useAppearance();
250
- const { setThemeMode } = useAppearanceActions();
251
- const isDark = themeMode === 'dark';
252
-
253
- const handleToggle = useCallback(() => {
254
- setThemeMode(isDark ? 'light' : 'dark');
255
- }, [isDark, setThemeMode]);
256
-
257
- return (
258
- <TouchableOpacity onPress={handleToggle}>
259
- <Ionicons
260
- name={isDark ? 'sunny-outline' : 'moon-outline'}
261
- size={24}
262
- color="black"
263
- />
264
- </TouchableOpacity>
265
- );
266
- }
267
- ```
85
+ Hook for accessing current appearance settings and theme mode.
268
86
 
269
- ### Live Preview
87
+ **Location**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/hooks/useAppearance.ts`
270
88
 
271
- ```tsx
272
- function AppearancePreview() {
273
- const { themeMode, customColors } = useAppearance();
274
- const { setThemeMode } = useAppearanceActions();
89
+ **Returns**:
90
+ - `themeMode: 'light' | 'dark' | 'auto'` - Current theme mode setting
91
+ - `customColors?: ColorPalette` - Custom color palette if set
92
+ - `isLoading: boolean` - Loading state indicator
93
+ - `error?: Error` - Error object if operation failed
275
94
 
276
- const effectiveTheme = useEffectiveTheme(themeMode);
95
+ **Use Cases**:
96
+ - Displaying current theme mode
97
+ - Checking if custom colors are active
98
+ - Rendering theme-aware UI components
277
99
 
278
- return (
279
- <View style={{ backgroundColor: effectiveTheme.background }}>
280
- <Text style={{ color: effectiveTheme.text }}>
281
- Theme Preview
282
- </Text>
100
+ ### useAppearanceActions
283
101
 
284
- <View style={{ backgroundColor: customColors?.primary }}>
285
- <Text>Primary Color</Text>
286
- </View>
102
+ Hook for accessing appearance action functions to update theme and colors.
287
103
 
288
- <TouchableOpacity onPress={() => setThemeMode('dark')}>
289
- <Text>Switch to Dark</Text>
290
- </TouchableOpacity>
291
- </View>
292
- );
293
- }
104
+ **Location**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/appearance/hooks/useAppearanceActions.ts`
294
105
 
295
- function useEffectiveTheme(themeMode: 'light' | 'dark' | 'auto') {
296
- const systemTheme = useColorScheme();
297
- const effectiveMode = themeMode === 'auto' ? systemTheme : themeMode;
106
+ **Returns**:
107
+ - `setThemeMode: (mode: 'light' | 'dark' | 'auto') => void` - Set theme mode
108
+ - `setCustomColors: (colors: ColorPalette) => void` - Set custom colors
109
+ - `resetColors: () => void` - Reset to default colors
110
+ - `isUpdating: boolean` - Update in progress indicator
298
111
 
299
- return effectiveMode === 'dark' ? darkTheme : lightTheme;
300
- }
301
- ```
112
+ **Use Cases**:
113
+ - Theme switcher component
114
+ - Custom color picker
115
+ - Reset appearance to defaults
302
116
 
303
- ## System Theme Detection
117
+ ## Theme Modes
304
118
 
305
- ### Auto Theme
119
+ ### Light Mode
306
120
 
307
- ```tsx
308
- function AutoThemeDetector() {
309
- const { themeMode } = useAppearance();
310
- const systemTheme = useColorScheme();
121
+ Explicit light theme regardless of system preferences.
311
122
 
312
- const effectiveTheme = useMemo(() => {
313
- if (themeMode === 'auto') {
314
- return systemTheme;
315
- }
316
- return themeMode;
317
- }, [themeMode, systemTheme]);
123
+ ### Dark Mode
318
124
 
319
- return (
320
- <Text>
321
- Theme Mode: {themeMode}
322
- Effective Theme: {effectiveTheme}
323
- </Text>
324
- );
325
- }
326
- ```
125
+ Explicit dark theme regardless of system preferences.
327
126
 
328
- ### Theme Provider
127
+ ### Auto Mode
329
128
 
330
- ```tsx
331
- function AppearanceProvider({ children }) {
332
- const { themeMode, customColors } = useAppearance();
129
+ Automatically switches between light and dark based on system preferences.
333
130
 
334
- const theme = useMemo(() => ({
335
- mode: themeMode,
336
- colors: customColors || defaultColors,
337
- }), [themeMode, customColors]);
131
+ ## Color Palette Structure
338
132
 
339
- return (
340
- <ThemeContext.Provider value={theme}>
341
- {children}
342
- </ThemeContext.Provider>
343
- );
133
+ ```typescript
134
+ interface ColorPalette {
135
+ primary: string; // Primary brand color
136
+ secondary: string; // Secondary brand color
137
+ accent: string; // Accent/highlight color
138
+ background: string; // Background color
139
+ surface: string; // Surface/card color
140
+ error: string; // Error state color
141
+ success: string; // Success state color
142
+ warning: string; // Warning state color
344
143
  }
345
144
  ```
346
145
 
@@ -354,13 +153,6 @@ function AppearanceProvider({ children }) {
354
153
  6. **Preview**: Show live preview of changes
355
154
  7. **Performance**: Use useMemo for expensive calculations
356
155
 
357
- ## Related
358
-
359
- - **AppearanceScreen**: Appearance screen component
360
- - **ThemeModeSection**: Theme mode section
361
- - **CustomColorsSection**: Custom colors section
362
- - **Appearance Store**: Zustand store for appearance state
363
-
364
156
  ## License
365
157
 
366
158
  MIT