@umituz/react-native-settings 4.20.57 → 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.
- 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/__tests__/setup.ts +1 -4
- 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 +99 -0
- 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 -442
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +153 -392
- 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/components/README.md +70 -295
- package/src/presentation/navigation/hooks/README.md +75 -367
- package/src/presentation/navigation/utils/README.md +100 -380
- package/src/presentation/screens/README.md +53 -504
- 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,322 +1,67 @@
|
|
|
1
1
|
# Settings Header
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Header component for the settings screen with optional close button functionality for modal/presentation styles.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Close Button**: Optional close button for modal/presentation
|
|
9
|
-
- **Auto Navigation**: Automatically goes back if no custom handler
|
|
10
|
-
- **Design System**: Uses design system tokens for styling
|
|
11
|
-
- **Internationalization**: Supports i18n
|
|
7
|
+
## File Paths
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
- **Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/SettingsHeader/SettingsHeader.tsx`
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
## Strategy
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
1. **Screen Title**: Displays localized "Settings" title using translation system
|
|
14
|
+
2. **Close Button**: Optional close button for modal presentation style
|
|
15
|
+
3. **Auto Navigation**: Automatically goes back if no custom handler is provided
|
|
16
|
+
4. **Design System**: Uses design system tokens for consistent styling
|
|
17
|
+
5. **Internationalization**: Supports i18n for all text content
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## Restrictions (Forbidden)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
### DO NOT
|
|
22
|
+
- ❌ DO NOT use SettingsHeader in non-modal presentations (let React Navigation handle header)
|
|
23
|
+
- ❌ DO NOT override the title text (use translation system)
|
|
24
|
+
- ❌ DO NOT add custom actions to the header
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{/* Rest of screen content */}
|
|
29
|
-
</>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
```
|
|
26
|
+
### NEVER
|
|
27
|
+
- ❌ NEVER use SettingsHeader with card-style stack navigation
|
|
28
|
+
- ❌ NEVER remove or hide the close button in modal presentation
|
|
29
|
+
- ❌ NEVER hardcode title text (must use translations)
|
|
33
30
|
|
|
34
|
-
###
|
|
31
|
+
### AVOID
|
|
32
|
+
- ❌ AVOID adding additional buttons or actions to the header
|
|
33
|
+
- ❌ AVOID custom styling that breaks design system consistency
|
|
34
|
+
- ❌ AVOID using SettingsHeader outside of modal presentation context
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
function ModalSettingsScreen() {
|
|
38
|
-
const handleClose = () => {
|
|
39
|
-
navigation.goBack();
|
|
40
|
-
};
|
|
36
|
+
## Rules (Mandatory)
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/>
|
|
48
|
-
{/* Settings content */}
|
|
49
|
-
</>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
```
|
|
38
|
+
### ALWAYS
|
|
39
|
+
- ✅ ALWAYS use close button in modal presentation (`presentation: 'modal'`)
|
|
40
|
+
- ✅ ALWAYS provide custom close handler when needed
|
|
41
|
+
- ✅ ALWAYS use translation keys for all text
|
|
42
|
+
- ✅ MUST set `headerShown: false` in screen options when using SettingsHeader
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
### MUST
|
|
45
|
+
- ✅ MUST ensure close button is easily tappable (44x44 minimum)
|
|
46
|
+
- ✅ MUST provide confirmation if there are unsaved changes
|
|
47
|
+
- ✅ MUST use proper navigation.goBack() as default close behavior
|
|
55
48
|
|
|
56
|
-
###
|
|
49
|
+
### SHOULD
|
|
50
|
+
- ✅ SHOULD use custom close handler for special actions (e.g., save before close)
|
|
51
|
+
- ✅ SHOULD test close button in both iOS and Android
|
|
52
|
+
- ✅ SHOULD ensure proper hit area for close button (hitSlop)
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|------|------|---------|-------------|
|
|
60
|
-
| `showCloseButton` | `boolean` | `false` | Show close button |
|
|
61
|
-
| `onClose` | `() => void` | `undefined` | Custom close handler |
|
|
54
|
+
## AI Agent Guidelines
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
1. **File Reference**: When modifying header behavior, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/SettingsHeader/SettingsHeader.tsx`
|
|
57
|
+
2. **Modal Setup**: Always set `presentation: 'modal'` and `headerShown: false` in screen options
|
|
58
|
+
3. **Close Handler**: If custom close logic is needed (save, confirm), provide via `onClose` prop
|
|
59
|
+
4. **Navigation**: Default behavior calls `navigation.goBack()` when no `onClose` is provided
|
|
60
|
+
5. **Accessibility**: Ensure close button has proper accessibility label
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
## Component Reference
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
### Close Handler
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
const handleClose = () => {
|
|
76
|
-
if (onClose) {
|
|
77
|
-
onClose(); // Use custom handler
|
|
78
|
-
} else {
|
|
79
|
-
navigation.goBack(); // Default navigation
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Examples
|
|
85
|
-
|
|
86
|
-
### Modal Settings
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
import { SettingsHeader } from '@umituz/react-native-settings';
|
|
90
|
-
import { Modal } from 'react-native';
|
|
91
|
-
|
|
92
|
-
function SettingsModal({ visible, onClose }) {
|
|
93
|
-
return (
|
|
94
|
-
<Modal visible={visible} animationType="slide">
|
|
95
|
-
<SettingsHeader
|
|
96
|
-
showCloseButton={true}
|
|
97
|
-
onClose={onClose}
|
|
98
|
-
/>
|
|
99
|
-
<SettingsContent />
|
|
100
|
-
</Modal>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Presentation Style
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
import { SettingsHeader } from '@umituz/react-native-settings';
|
|
109
|
-
|
|
110
|
-
function PresentationSettings() {
|
|
111
|
-
const navigation = useNavigation();
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<Stack.Screen
|
|
115
|
-
name="Settings"
|
|
116
|
-
options={{
|
|
117
|
-
presentation: 'modal',
|
|
118
|
-
headerShown: false,
|
|
119
|
-
}}
|
|
120
|
-
>
|
|
121
|
-
{() => (
|
|
122
|
-
<View>
|
|
123
|
-
<SettingsHeader
|
|
124
|
-
showCloseButton={true}
|
|
125
|
-
onClose={() => navigation.goBack()}
|
|
126
|
-
/>
|
|
127
|
-
<SettingsContent />
|
|
128
|
-
</View>
|
|
129
|
-
)}
|
|
130
|
-
</Stack.Screen>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Custom Close Action
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
function SettingsWithCustomClose() {
|
|
139
|
-
const handleClose = () => {
|
|
140
|
-
// Custom logic before closing
|
|
141
|
-
saveDraftChanges();
|
|
142
|
-
navigation.goBack();
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<SettingsHeader
|
|
147
|
-
showCloseButton={true}
|
|
148
|
-
onClose={handleClose}
|
|
149
|
-
/>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Close with Confirmation
|
|
155
|
-
|
|
156
|
-
```tsx
|
|
157
|
-
function SettingsWithConfirmation() {
|
|
158
|
-
const handleClose = () => {
|
|
159
|
-
Alert.alert(
|
|
160
|
-
'Discard Changes?',
|
|
161
|
-
'You have unsaved changes',
|
|
162
|
-
[
|
|
163
|
-
{ text: 'Keep Editing', style: 'cancel' },
|
|
164
|
-
{
|
|
165
|
-
text: 'Discard',
|
|
166
|
-
style: 'destructive',
|
|
167
|
-
onPress: () => navigation.goBack(),
|
|
168
|
-
},
|
|
169
|
-
]
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
<SettingsHeader
|
|
175
|
-
showCloseButton={true}
|
|
176
|
-
onClose={handleClose}
|
|
177
|
-
/>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## Styling
|
|
183
|
-
|
|
184
|
-
### Layout
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
const styles = StyleSheet.create({
|
|
188
|
-
container: {
|
|
189
|
-
flexDirection: 'row',
|
|
190
|
-
justifyContent: 'space-between',
|
|
191
|
-
alignItems: 'center',
|
|
192
|
-
padding: tokens.spacing.lg, // 16px
|
|
193
|
-
},
|
|
194
|
-
closeButton: {
|
|
195
|
-
width: 44,
|
|
196
|
-
height: 44,
|
|
197
|
-
justifyContent: 'center',
|
|
198
|
-
alignItems: 'center',
|
|
199
|
-
},
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Pressable Style
|
|
204
|
-
|
|
205
|
-
The close button uses Pressable with pressed state:
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
style={({ pressed }) => [
|
|
209
|
-
styles.closeButton,
|
|
210
|
-
{
|
|
211
|
-
backgroundColor: pressed
|
|
212
|
-
? tokens.colors.surfaceVariant
|
|
213
|
-
: tokens.colors.surface,
|
|
214
|
-
borderRadius: tokens.borderRadius.full,
|
|
215
|
-
},
|
|
216
|
-
]
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Internationalization
|
|
220
|
-
|
|
221
|
-
Uses translation key for title:
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
t('settings.title')
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Design System Integration
|
|
228
|
-
|
|
229
|
-
- **Typography**: `tokens.typography.headingLarge` for title
|
|
230
|
-
- **Colors**: `tokens.colors.textPrimary` for close icon
|
|
231
|
-
- **Spacing**: `tokens.spacing.lg` for padding
|
|
232
|
-
- **Border Radius**: `tokens.borderRadius.full` for button
|
|
233
|
-
- **Icons**: `AtomicIcon` from design system
|
|
234
|
-
|
|
235
|
-
## Accessibility
|
|
236
|
-
|
|
237
|
-
### Hit Slop
|
|
238
|
-
|
|
239
|
-
Close button has increased hit area:
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Icon
|
|
246
|
-
|
|
247
|
-
Uses `close-outline` icon from Ionicons:
|
|
248
|
-
|
|
249
|
-
```typescript
|
|
250
|
-
<AtomicIcon name="close-outline" size="lg" color="textPrimary" />
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Best Practices
|
|
254
|
-
|
|
255
|
-
1. **Modal Screens**: Always use close button in modal presentation
|
|
256
|
-
2. **Custom Handler**: Provide custom close handler when needed
|
|
257
|
-
3. **Confirmation**: Ask for confirmation if there are unsaved changes
|
|
258
|
-
4. **Consistent Position**: Keep header at top of screen
|
|
259
|
-
5. **Padding**: Use design system spacing for consistency
|
|
260
|
-
6. **Accessibility**: Ensure close button is easily tappable
|
|
261
|
-
|
|
262
|
-
## Use Cases
|
|
263
|
-
|
|
264
|
-
### Modal Presentation
|
|
265
|
-
|
|
266
|
-
```tsx
|
|
267
|
-
<Stack.Screen
|
|
268
|
-
name="Settings"
|
|
269
|
-
options={{
|
|
270
|
-
presentation: 'modal',
|
|
271
|
-
headerShown: false,
|
|
272
|
-
}}
|
|
273
|
-
>
|
|
274
|
-
{() => (
|
|
275
|
-
<View>
|
|
276
|
-
<SettingsHeader showCloseButton={true} />
|
|
277
|
-
<SettingsContent />
|
|
278
|
-
</View>
|
|
279
|
-
)}
|
|
280
|
-
</Stack.Screen>
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### Full Screen with Close
|
|
284
|
-
|
|
285
|
-
```tsx
|
|
286
|
-
function FullScreenSettings() {
|
|
287
|
-
return (
|
|
288
|
-
<ScreenLayout
|
|
289
|
-
header={<SettingsHeader showCloseButton={true} />}
|
|
290
|
-
>
|
|
291
|
-
<SettingsContent />
|
|
292
|
-
</ScreenLayout>
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### No Close Button (Default)
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
function RegularSettingsScreen() {
|
|
301
|
-
return (
|
|
302
|
-
<Stack.Screen name="Settings">
|
|
303
|
-
{() => (
|
|
304
|
-
<View>
|
|
305
|
-
<SettingsHeader />
|
|
306
|
-
<SettingsContent />
|
|
307
|
-
</View>
|
|
308
|
-
)}
|
|
309
|
-
</Stack.Screen>
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Related
|
|
315
|
-
|
|
316
|
-
- **SettingsScreen**: Main screen component
|
|
317
|
-
- **SettingsContent**: Content component
|
|
318
|
-
- **Design System**: Styling and theming
|
|
319
|
-
|
|
320
|
-
## License
|
|
321
|
-
|
|
322
|
-
MIT
|
|
64
|
+
Related components:
|
|
65
|
+
- **SettingsScreen**: Main screen component that uses SettingsHeader
|
|
66
|
+
- **SettingsContent**: Content component that appears below header
|
|
67
|
+
- **Design System**: Styling and theming tokens
|