@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.
- 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/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,532 +1,100 @@
|
|
|
1
1
|
# Navigation System
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Components
|
|
6
|
-
|
|
7
|
-
### SettingsStackNavigator
|
|
8
|
-
|
|
9
|
-
Main stack navigator for all settings-related screens.
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import { SettingsStackNavigator } from '@umituz/react-native-settings';
|
|
13
|
-
|
|
14
|
-
function App() {
|
|
15
|
-
const appInfo = {
|
|
16
|
-
name: 'My App',
|
|
17
|
-
version: '1.0.0',
|
|
18
|
-
// ... other app info
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const legalUrls = {
|
|
22
|
-
privacyPolicy: 'https://example.com/privacy',
|
|
23
|
-
termsOfService: 'https://example.com/terms',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const faqData = {
|
|
27
|
-
categories: [
|
|
28
|
-
// FAQ categories
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<NavigationContainer>
|
|
34
|
-
<SettingsStackNavigator
|
|
35
|
-
appInfo={appInfo}
|
|
36
|
-
legalUrls={legalUrls}
|
|
37
|
-
faqData={faqData}
|
|
38
|
-
/>
|
|
39
|
-
</NavigationContainer>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### Props
|
|
45
|
-
|
|
46
|
-
| Prop | Type | Default | Description |
|
|
47
|
-
|------|------|---------|-------------|
|
|
48
|
-
| `appInfo` | `AppInfo` | **Required** | Application information |
|
|
49
|
-
| `legalUrls` | `LegalUrls` | **Required** | Legal document URLs |
|
|
50
|
-
| `faqData` | `FAQData` | `undefined` | FAQ data |
|
|
51
|
-
| `config` | `SettingsConfig` | `{}` | Settings configuration |
|
|
52
|
-
| `showUserProfile` | `boolean` | `false` | Show user profile header |
|
|
53
|
-
| `userProfile` | `UserProfile` | `undefined` | User profile data |
|
|
54
|
-
| `additionalScreens` | `Screen[]` | `[]` | Additional screens to add |
|
|
55
|
-
| `devSettings` | `DevSettingsProps` | `undefined` | Dev settings configuration |
|
|
56
|
-
| `customSections` | `CustomSection[]` | `[]` | Custom settings sections |
|
|
57
|
-
|
|
58
|
-
### Screen Wrappers
|
|
59
|
-
|
|
60
|
-
Wrapper components that handle configuration and props for each screen.
|
|
61
|
-
|
|
62
|
-
#### SettingsScreenWrapper
|
|
63
|
-
|
|
64
|
-
Wraps the main settings screen with configuration.
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import { SettingsScreenWrapper } from '@umituz/react-native-settings';
|
|
68
|
-
|
|
69
|
-
<SettingsScreenWrapper
|
|
70
|
-
config={config}
|
|
71
|
-
appVersion={appInfo.version}
|
|
72
|
-
showUserProfile={showUserProfile}
|
|
73
|
-
userProfile={userProfile}
|
|
74
|
-
devSettings={devSettings}
|
|
75
|
-
customSections={customSections}
|
|
76
|
-
/>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
#### LegalScreenWrapper
|
|
80
|
-
|
|
81
|
-
Wraps the legal screen with proper handlers and translations.
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import { LegalScreenWrapper } from '@umituz/react-native-settings';
|
|
85
|
-
|
|
86
|
-
<LegalScreenWrapper
|
|
87
|
-
onPrivacyPress={handlePrivacy}
|
|
88
|
-
onTermsPress={handleTerms}
|
|
89
|
-
onEulaPress={handleEula}
|
|
90
|
-
/>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### AboutScreenWrapper
|
|
94
|
-
|
|
95
|
-
Wraps the about screen with app configuration.
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
-
import { AboutScreenWrapper } from '@umituz/react-native-settings';
|
|
99
|
-
|
|
100
|
-
<AboutScreenWrapper
|
|
101
|
-
config={aboutConfig}
|
|
102
|
-
/>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Navigation Hooks
|
|
106
|
-
|
|
107
|
-
### useNavigationHandlers
|
|
108
|
-
|
|
109
|
-
Hook for managing navigation handlers and screen props.
|
|
110
|
-
|
|
111
|
-
```tsx
|
|
112
|
-
import { useNavigationHandlers } from '@umituz/react-native-settings';
|
|
113
|
-
|
|
114
|
-
function NavigationSetup() {
|
|
115
|
-
const { handlePrivacyPress, handleTermsPress, handleEulaPress, aboutConfig } =
|
|
116
|
-
useNavigationHandlers(appInfo, legalUrls);
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<Stack.Navigator>
|
|
120
|
-
<Stack.Screen name="Legal">
|
|
121
|
-
{() => (
|
|
122
|
-
<LegalScreen
|
|
123
|
-
onPrivacyPress={handlePrivacyPress}
|
|
124
|
-
onTermsPress={handleTermsPress}
|
|
125
|
-
onEulaPress={handleEulaPress}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
</Stack.Screen>
|
|
129
|
-
<Stack.Screen name="About">
|
|
130
|
-
{() => <AboutScreen config={aboutConfig} />}
|
|
131
|
-
</Stack.Screen>
|
|
132
|
-
</Stack.Navigator>
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Navigation Utilities
|
|
138
|
-
|
|
139
|
-
### Screen Options
|
|
140
|
-
|
|
141
|
-
Utility functions for creating screen options with translations.
|
|
3
|
+
## Purpose
|
|
142
4
|
|
|
143
|
-
|
|
144
|
-
import {
|
|
145
|
-
createScreenOptions,
|
|
146
|
-
createAppearanceScreenOptions,
|
|
147
|
-
createLegalScreenOptions,
|
|
148
|
-
createAboutScreenOptions,
|
|
149
|
-
createFAQScreenOptions,
|
|
150
|
-
} from '@umituz/react-native-settings';
|
|
151
|
-
|
|
152
|
-
// Create base screen options
|
|
153
|
-
const screenOptions = createScreenOptions(tokens);
|
|
154
|
-
|
|
155
|
-
// Create specific screen options
|
|
156
|
-
const appearanceOptions = createAppearanceScreenOptions(t);
|
|
157
|
-
const legalOptions = createLegalScreenOptions(t);
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Translation Utilities
|
|
161
|
-
|
|
162
|
-
```tsx
|
|
163
|
-
import {
|
|
164
|
-
createNotificationTranslations,
|
|
165
|
-
createQuietHoursTranslations,
|
|
166
|
-
} from '@umituz/react-native-settings';
|
|
167
|
-
|
|
168
|
-
const notificationTranslations = createNotificationTranslations(t);
|
|
169
|
-
const quietHoursTranslations = createQuietHoursTranslations(t);
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Complete Examples
|
|
173
|
-
|
|
174
|
-
### Basic Navigation Setup
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
import React from 'react';
|
|
178
|
-
import { NavigationContainer } from '@react-navigation/native';
|
|
179
|
-
import { SettingsStackNavigator } from '@umituz/react-native-settings';
|
|
180
|
-
|
|
181
|
-
export default function App() {
|
|
182
|
-
const appInfo = {
|
|
183
|
-
name: 'My Application',
|
|
184
|
-
version: '1.0.0',
|
|
185
|
-
buildNumber: '100',
|
|
186
|
-
developer: 'My Company',
|
|
187
|
-
contactEmail: 'support@example.com',
|
|
188
|
-
websiteUrl: 'https://example.com',
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const legalUrls = {
|
|
192
|
-
privacyPolicy: 'https://example.com/privacy',
|
|
193
|
-
termsOfService: 'https://example.com/terms',
|
|
194
|
-
eula: 'https://example.com/eula',
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const faqData = {
|
|
198
|
-
categories: [
|
|
199
|
-
{
|
|
200
|
-
id: 'general',
|
|
201
|
-
title: 'General',
|
|
202
|
-
questions: [
|
|
203
|
-
{
|
|
204
|
-
id: 'q1',
|
|
205
|
-
question: 'What is this app?',
|
|
206
|
-
answer: 'Description here...',
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
return (
|
|
214
|
-
<NavigationContainer>
|
|
215
|
-
<SettingsStackNavigator
|
|
216
|
-
appInfo={appInfo}
|
|
217
|
-
legalUrls={legalUrls}
|
|
218
|
-
faqData={faqData}
|
|
219
|
-
/>
|
|
220
|
-
</NavigationContainer>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
### With User Profile
|
|
226
|
-
|
|
227
|
-
```tsx
|
|
228
|
-
function AppWithUserProfile() {
|
|
229
|
-
const { user } = useAuth();
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
<NavigationContainer>
|
|
233
|
-
<SettingsStackNavigator
|
|
234
|
-
appInfo={appInfo}
|
|
235
|
-
legalUrls={legalUrls}
|
|
236
|
-
showUserProfile={true}
|
|
237
|
-
userProfile={{
|
|
238
|
-
displayName: user?.displayName,
|
|
239
|
-
userId: user?.uid,
|
|
240
|
-
avatarUrl: user?.photoURL,
|
|
241
|
-
onPress: () => navigation.navigate('AccountSettings'),
|
|
242
|
-
}}
|
|
243
|
-
/>
|
|
244
|
-
</NavigationContainer>
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### With Custom Configuration
|
|
250
|
-
|
|
251
|
-
```tsx
|
|
252
|
-
function AppWithCustomConfig() {
|
|
253
|
-
const config = {
|
|
254
|
-
appearance: true,
|
|
255
|
-
language: false,
|
|
256
|
-
notifications: true,
|
|
257
|
-
privacy: true,
|
|
258
|
-
support: true,
|
|
259
|
-
about: true,
|
|
260
|
-
legal: true,
|
|
261
|
-
feedback: true,
|
|
262
|
-
faqs: true,
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
return (
|
|
266
|
-
<NavigationContainer>
|
|
267
|
-
<SettingsStackNavigator
|
|
268
|
-
config={config}
|
|
269
|
-
appInfo={appInfo}
|
|
270
|
-
legalUrls={legalUrls}
|
|
271
|
-
/>
|
|
272
|
-
</NavigationContainer>
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### With Additional Screens
|
|
278
|
-
|
|
279
|
-
```tsx
|
|
280
|
-
function AppWithAdditionalScreens() {
|
|
281
|
-
const additionalScreens = [
|
|
282
|
-
{
|
|
283
|
-
name: 'AccountSettings' as const,
|
|
284
|
-
component: AccountSettingsScreen,
|
|
285
|
-
options: { title: 'Account' },
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: 'Integrations' as const,
|
|
289
|
-
options: { title: 'Integrations' },
|
|
290
|
-
children: () => <IntegrationsScreen />,
|
|
291
|
-
},
|
|
292
|
-
];
|
|
293
|
-
|
|
294
|
-
return (
|
|
295
|
-
<NavigationContainer>
|
|
296
|
-
<SettingsStackNavigator
|
|
297
|
-
appInfo={appInfo}
|
|
298
|
-
legalUrls={legalUrls}
|
|
299
|
-
additionalScreens={additionalScreens}
|
|
300
|
-
/>
|
|
301
|
-
</NavigationContainer>
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### With Custom Sections
|
|
307
|
-
|
|
308
|
-
```tsx
|
|
309
|
-
function AppWithCustomSections() {
|
|
310
|
-
const customSections = [
|
|
311
|
-
{
|
|
312
|
-
title: 'INTEGRATIONS',
|
|
313
|
-
items: [
|
|
314
|
-
{
|
|
315
|
-
icon: 'logo-google',
|
|
316
|
-
title: 'Google',
|
|
317
|
-
description: 'Connected',
|
|
318
|
-
showSwitch: true,
|
|
319
|
-
switchValue: googleEnabled,
|
|
320
|
-
onSwitchChange: setGoogleEnabled,
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
},
|
|
324
|
-
];
|
|
325
|
-
|
|
326
|
-
return (
|
|
327
|
-
<NavigationContainer>
|
|
328
|
-
<SettingsStackNavigator
|
|
329
|
-
appInfo={appInfo}
|
|
330
|
-
legalUrls={legalUrls}
|
|
331
|
-
customSections={customSections}
|
|
332
|
-
/>
|
|
333
|
-
</NavigationContainer>
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### With Dev Settings
|
|
339
|
-
|
|
340
|
-
```tsx
|
|
341
|
-
import { DevSettingsSection } from '@umituz/react-native-settings';
|
|
342
|
-
|
|
343
|
-
function AppWithDevSettings() {
|
|
344
|
-
return (
|
|
345
|
-
<NavigationContainer>
|
|
346
|
-
<SettingsStackNavigator
|
|
347
|
-
appInfo={appInfo}
|
|
348
|
-
legalUrls={legalUrls}
|
|
349
|
-
devSettings={{
|
|
350
|
-
enabled: true,
|
|
351
|
-
onAfterClear: async () => {
|
|
352
|
-
await resetApp();
|
|
353
|
-
Updates.reloadAsync();
|
|
354
|
-
},
|
|
355
|
-
}}
|
|
356
|
-
/>
|
|
357
|
-
</NavigationContainer>
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
## Navigation Types
|
|
363
|
-
|
|
364
|
-
### SettingsStackParamList
|
|
365
|
-
|
|
366
|
-
Type definition for all navigation params:
|
|
367
|
-
|
|
368
|
-
```typescript
|
|
369
|
-
type SettingsStackParamList = {
|
|
370
|
-
SettingsMain: undefined;
|
|
371
|
-
Appearance: undefined;
|
|
372
|
-
About: { config?: AboutConfig };
|
|
373
|
-
Legal: LegalScreenProps;
|
|
374
|
-
Notifications: undefined;
|
|
375
|
-
FAQ: undefined;
|
|
376
|
-
LanguageSelection: undefined;
|
|
377
|
-
// ... additional screens
|
|
378
|
-
};
|
|
379
|
-
```
|
|
5
|
+
Complete navigation setup for settings screens using React Navigation with stack navigator, screen wrappers, and navigation utilities.
|
|
380
6
|
|
|
381
|
-
|
|
7
|
+
## File Paths
|
|
382
8
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
faqData?: FAQData;
|
|
388
|
-
config?: SettingsConfig;
|
|
389
|
-
showUserProfile?: boolean;
|
|
390
|
-
userProfile?: UserProfile;
|
|
391
|
-
additionalScreens?: AdditionalScreen[];
|
|
392
|
-
devSettings?: DevSettingsProps;
|
|
393
|
-
customSections?: CustomSettingsSection[];
|
|
394
|
-
}
|
|
395
|
-
```
|
|
9
|
+
- **Navigator**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/navigation/SettingsStackNavigator.tsx`
|
|
10
|
+
- **Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/navigation/components/`
|
|
11
|
+
- **Hooks**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/navigation/hooks/`
|
|
12
|
+
- **Utils**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/navigation/utils/`
|
|
396
13
|
|
|
397
|
-
##
|
|
14
|
+
## Strategy
|
|
398
15
|
|
|
399
|
-
|
|
16
|
+
1. **Stack Navigator**: Provides stack-based navigation for all settings screens
|
|
17
|
+
2. **Screen Wrappers**: Handles configuration and props passing for each screen
|
|
18
|
+
3. **Type Safety**: TypeScript definitions for all navigation params
|
|
19
|
+
4. **Screen Options**: Consistent screen options with translations
|
|
20
|
+
5. **Custom Screens**: Support for additional screens via props
|
|
400
21
|
|
|
401
|
-
|
|
402
|
-
import { useNavigation } from '@react-navigation/native';
|
|
22
|
+
## Restrictions (Forbidden)
|
|
403
23
|
|
|
404
|
-
|
|
405
|
-
|
|
24
|
+
### DO NOT
|
|
25
|
+
- ❌ DO NOT manually create screen wrappers (use provided ones)
|
|
26
|
+
- ❌ DO NOT bypass screen wrappers for props injection
|
|
27
|
+
- ❌ DO NOT hardcode screen options (use utility functions)
|
|
406
28
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
onPress={() => navigation.navigate('Appearance')}
|
|
412
|
-
/>
|
|
413
|
-
<Button
|
|
414
|
-
title="Go to About"
|
|
415
|
-
onPress={() => navigation.navigate('About')}
|
|
416
|
-
/>
|
|
417
|
-
<Button
|
|
418
|
-
title="Go to Legal"
|
|
419
|
-
onPress={() => navigation.navigate('Legal')}
|
|
420
|
-
/>
|
|
421
|
-
</View>
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
```
|
|
29
|
+
### NEVER
|
|
30
|
+
- ❌ NEVER use SettingsStackNavigator without NavigationContainer
|
|
31
|
+
- ❌ NEVER wrap SettingsStackNavigator in another error boundary
|
|
32
|
+
- ❌ NEVER pass navigation props directly to screen components
|
|
425
33
|
|
|
426
|
-
###
|
|
34
|
+
### AVOID
|
|
35
|
+
- ❌ AVOID creating multiple instances of SettingsStackNavigator
|
|
36
|
+
- ❌ AVOID mixing navigation patterns (stick to stack navigation)
|
|
37
|
+
- ❌ AVOID deep linking without proper configuration
|
|
427
38
|
|
|
428
|
-
|
|
429
|
-
<Button
|
|
430
|
-
title="Go to About"
|
|
431
|
-
onPress={() =>
|
|
432
|
-
navigation.navigate('About', {
|
|
433
|
-
config: {
|
|
434
|
-
appName: 'My App',
|
|
435
|
-
version: '1.0.0',
|
|
436
|
-
},
|
|
437
|
-
})
|
|
438
|
-
}
|
|
439
|
-
/>
|
|
440
|
-
```
|
|
39
|
+
## Rules (Mandatory)
|
|
441
40
|
|
|
442
|
-
|
|
41
|
+
### ALWAYS
|
|
42
|
+
- ✅ ALWAYS use screen wrappers for proper props injection
|
|
43
|
+
- ✅ ALWAYS provide required props: appInfo, legalUrls
|
|
44
|
+
- ✅ ALWAYS use TypeScript types for navigation params
|
|
45
|
+
- ✅ MUST wrap navigator in NavigationContainer
|
|
443
46
|
|
|
444
|
-
|
|
47
|
+
### MUST
|
|
48
|
+
- ✅ MUST pass configuration via props, not hardcoded
|
|
49
|
+
- ✅ MUST handle navigation errors gracefully
|
|
50
|
+
- ✅ MUST provide translation function to all screens
|
|
445
51
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<AboutScreen
|
|
451
|
-
config={{
|
|
452
|
-
appName: appInfo.name,
|
|
453
|
-
version: appInfo.version,
|
|
454
|
-
// ... manually pass all props
|
|
455
|
-
}}
|
|
456
|
-
/>
|
|
457
|
-
)}
|
|
458
|
-
</Stack.Screen>
|
|
52
|
+
### SHOULD
|
|
53
|
+
- ✅ SHOULD use modal presentation for settings on iOS
|
|
54
|
+
- ✅ SHOULD support deep linking to settings screens
|
|
55
|
+
- ✅ SHOULD use additionalScreens prop for custom screens
|
|
459
56
|
|
|
460
|
-
|
|
461
|
-
<Stack.Screen name="About">
|
|
462
|
-
{() => <AboutScreenWrapper config={aboutConfig} />}
|
|
463
|
-
</Stack.Screen>
|
|
464
|
-
```
|
|
57
|
+
## AI Agent Guidelines
|
|
465
58
|
|
|
466
|
-
|
|
59
|
+
1. **File Reference**: When modifying navigation, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/navigation/`
|
|
60
|
+
2. **Screen Wrappers**: Always use screen wrappers (SettingsScreenWrapper, LegalScreenWrapper, AboutScreenWrapper) for proper configuration
|
|
61
|
+
3. **Props Passing**: Configuration is passed via navigator props and injected by wrappers
|
|
62
|
+
4. **Type Safety**: Use SettingsStackParamList for type-safe navigation
|
|
63
|
+
5. **Custom Screens**: Add app-specific screens via `additionalScreens` prop
|
|
467
64
|
|
|
468
|
-
|
|
469
|
-
2. **Type Safety**: Use TypeScript types for navigation params
|
|
470
|
-
3. **Error Boundaries**: Include error boundaries in navigation
|
|
471
|
-
4. **Translation Keys**: Use translation keys for all text
|
|
472
|
-
5. **Deep Linking**: Support deep linking to settings screens
|
|
473
|
-
6. **Custom Screens**: Use `additionalScreens` for custom screens
|
|
474
|
-
7. **Configuration**: Pass config through props, not hardcoded
|
|
475
|
-
8. **User Profile**: Show user profile when user is authenticated
|
|
65
|
+
## Component Reference
|
|
476
66
|
|
|
477
|
-
|
|
67
|
+
### SettingsStackNavigator
|
|
478
68
|
|
|
479
|
-
|
|
480
|
-
import { render } from '@testing-library/react-native';
|
|
481
|
-
import { SettingsStackNavigator } from '@umituz/react-native-navigation';
|
|
482
|
-
import { NavigationContainer } from '@react-navigation/native';
|
|
69
|
+
**Purpose**: Main stack navigator for all settings screens
|
|
483
70
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
version: '1.0.0',
|
|
488
|
-
};
|
|
71
|
+
**Required Props**:
|
|
72
|
+
- `appInfo`: Application information object
|
|
73
|
+
- `legalUrls`: Legal document URLs
|
|
489
74
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
75
|
+
**Optional Props**:
|
|
76
|
+
- `faqData`: FAQ data
|
|
77
|
+
- `config`: Settings configuration
|
|
78
|
+
- `showUserProfile`: Show user profile header
|
|
79
|
+
- `userProfile`: User profile data
|
|
80
|
+
- `additionalScreens`: Additional screens to add
|
|
81
|
+
- `devSettings`: Dev settings configuration
|
|
82
|
+
- `customSections`: Custom settings sections
|
|
494
83
|
|
|
495
|
-
|
|
496
|
-
const { getByText } = render(
|
|
497
|
-
<NavigationContainer>
|
|
498
|
-
<SettingsStackNavigator
|
|
499
|
-
appInfo={mockAppInfo}
|
|
500
|
-
legalUrls={mockLegalUrls}
|
|
501
|
-
/>
|
|
502
|
-
</NavigationContainer>
|
|
503
|
-
);
|
|
84
|
+
### Screen Wrappers
|
|
504
85
|
|
|
505
|
-
|
|
506
|
-
|
|
86
|
+
**SettingsScreenWrapper**: Wraps main settings screen with configuration
|
|
87
|
+
**LegalScreenWrapper**: Wraps legal screens with content and styling
|
|
88
|
+
**AboutScreenWrapper**: Wraps about screen with app information
|
|
507
89
|
|
|
508
|
-
|
|
509
|
-
const { getByText } = render(
|
|
510
|
-
<NavigationContainer>
|
|
511
|
-
<SettingsStackNavigator
|
|
512
|
-
appInfo={mockAppInfo}
|
|
513
|
-
legalUrls={mockLegalUrls}
|
|
514
|
-
/>
|
|
515
|
-
</NavigationContainer>
|
|
516
|
-
);
|
|
90
|
+
### Navigation Utilities
|
|
517
91
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
});
|
|
522
|
-
```
|
|
92
|
+
**useNavigationHandlers**: Hook for managing navigation handlers
|
|
93
|
+
**createScreenOptions**: Utility for creating screen options
|
|
94
|
+
**createNotificationTranslations**: Utility for notification translations
|
|
523
95
|
|
|
524
|
-
## Related
|
|
96
|
+
## Related Components
|
|
525
97
|
|
|
526
98
|
- **Presentation Screens**: Screen components
|
|
527
99
|
- **Navigation Hooks**: Custom navigation hooks
|
|
528
|
-
- **React Navigation**: Official React Navigation
|
|
529
|
-
|
|
530
|
-
## License
|
|
531
|
-
|
|
532
|
-
MIT
|
|
100
|
+
- **React Navigation**: Official React Navigation documentation
|