@umituz/react-native-settings 4.20.56 → 4.20.57
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 +145 -3
- package/package.json +1 -2
- 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/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 +461 -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,330 @@
|
|
|
1
|
+
# Navigation Components
|
|
2
|
+
|
|
3
|
+
Screen wrapper components for integrating settings screens into React Navigation with proper props passing and configuration.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
### SettingsScreenWrapper
|
|
8
|
+
|
|
9
|
+
Wrapper component for the main Settings screen that injects configuration, navigation, and user profile props.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { SettingsScreenWrapper } from '@umituz/react-native-settings';
|
|
13
|
+
|
|
14
|
+
<Stack.Screen
|
|
15
|
+
name="Settings"
|
|
16
|
+
component={SettingsScreenWrapper}
|
|
17
|
+
options={{ headerShown: false }}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Props
|
|
22
|
+
|
|
23
|
+
Automatically receives and injects:
|
|
24
|
+
- `config`: Settings configuration from navigation params
|
|
25
|
+
- `appInfo`: Application information object
|
|
26
|
+
- `userProfile`: User profile data
|
|
27
|
+
- `customSections`: Custom settings sections
|
|
28
|
+
- `devSettings`: Development settings configuration
|
|
29
|
+
|
|
30
|
+
### LegalScreenWrapper
|
|
31
|
+
|
|
32
|
+
Wrapper component for legal screens (Privacy Policy, Terms of Service, etc.) with content and styling configuration.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { LegalScreenWrapper } from '@umituz/react-native-settings';
|
|
36
|
+
|
|
37
|
+
<Stack.Screen
|
|
38
|
+
name="PrivacyPolicy"
|
|
39
|
+
component={LegalScreenWrapper}
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Features
|
|
44
|
+
|
|
45
|
+
- Dynamic document type from route params
|
|
46
|
+
- Content injection from navigation
|
|
47
|
+
- Custom styling support
|
|
48
|
+
- Title and header configuration
|
|
49
|
+
|
|
50
|
+
### AboutScreenWrapper
|
|
51
|
+
|
|
52
|
+
Wrapper component for the About screen with app information and developer details.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { AboutScreenWrapper } from '@umituz/react-native-settings';
|
|
56
|
+
|
|
57
|
+
<Stack.Screen
|
|
58
|
+
name="About"
|
|
59
|
+
component={AboutScreenWrapper}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Features
|
|
64
|
+
|
|
65
|
+
- App information injection
|
|
66
|
+
- Developer details display
|
|
67
|
+
- Contact information handling
|
|
68
|
+
- Version and build number display
|
|
69
|
+
|
|
70
|
+
## Screen Registration
|
|
71
|
+
|
|
72
|
+
### Complete Navigation Setup
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { SettingsStackNavigator } from '@umituz/react-native-settings';
|
|
76
|
+
|
|
77
|
+
function App() {
|
|
78
|
+
const appInfo = {
|
|
79
|
+
name: 'My App',
|
|
80
|
+
version: '1.0.0',
|
|
81
|
+
buildNumber: '100',
|
|
82
|
+
developer: 'My Company',
|
|
83
|
+
websiteUrl: 'https://example.com',
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<NavigationContainer>
|
|
88
|
+
<SettingsStackNavigator appInfo={appInfo} />
|
|
89
|
+
</NavigationContainer>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Manual Screen Registration
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { SettingsScreenWrapper, LegalScreenWrapper, AboutScreenWrapper } from '@umituz/react-native-settings';
|
|
98
|
+
|
|
99
|
+
<Stack.Navigator>
|
|
100
|
+
<Stack.Screen
|
|
101
|
+
name="Settings"
|
|
102
|
+
component={SettingsScreenWrapper}
|
|
103
|
+
options={{
|
|
104
|
+
headerShown: false,
|
|
105
|
+
presentation: 'card',
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
<Stack.Screen
|
|
109
|
+
name="Appearance"
|
|
110
|
+
component={AppearanceScreen}
|
|
111
|
+
options={{ title: 'Appearance' }}
|
|
112
|
+
/>
|
|
113
|
+
<Stack.Screen
|
|
114
|
+
name="PrivacyPolicy"
|
|
115
|
+
component={LegalScreenWrapper}
|
|
116
|
+
options={{ title: 'Privacy Policy' }}
|
|
117
|
+
/>
|
|
118
|
+
<Stack.Screen
|
|
119
|
+
name="TermsOfService"
|
|
120
|
+
component={LegalScreenWrapper}
|
|
121
|
+
options={{ title: 'Terms of Service' }}
|
|
122
|
+
/>
|
|
123
|
+
<Stack.Screen
|
|
124
|
+
name="About"
|
|
125
|
+
component={AboutScreenWrapper}
|
|
126
|
+
options={{ title: 'About' }}
|
|
127
|
+
/>
|
|
128
|
+
</Stack.Navigator>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Props Injection
|
|
132
|
+
|
|
133
|
+
### SettingsScreenWrapper
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
interface SettingsScreenWrapperProps {
|
|
137
|
+
route: {
|
|
138
|
+
params: {
|
|
139
|
+
config?: SettingsConfig;
|
|
140
|
+
appInfo?: AppInfo;
|
|
141
|
+
userProfile?: UserProfile;
|
|
142
|
+
customSections?: CustomSettingsSection[];
|
|
143
|
+
devSettings?: DevSettingsProps;
|
|
144
|
+
showCloseButton?: boolean;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
navigation: any;
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### LegalScreenWrapper
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
interface LegalScreenWrapperProps {
|
|
155
|
+
route: {
|
|
156
|
+
params: {
|
|
157
|
+
documentType: 'privacy-policy' | 'terms-of-service' | 'eula';
|
|
158
|
+
content?: string;
|
|
159
|
+
title?: string;
|
|
160
|
+
styles?: LegalContentStyles;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### AboutScreenWrapper
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
interface AboutScreenWrapperProps {
|
|
170
|
+
route: {
|
|
171
|
+
params: {
|
|
172
|
+
appInfo?: AppInfo;
|
|
173
|
+
config?: AboutConfig;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Usage Examples
|
|
180
|
+
|
|
181
|
+
### With Custom Config
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
function SettingsStack() {
|
|
185
|
+
const config = {
|
|
186
|
+
appearance: true,
|
|
187
|
+
language: true,
|
|
188
|
+
notifications: 'auto',
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const userProfile = {
|
|
192
|
+
displayName: 'John Doe',
|
|
193
|
+
email: 'john@example.com',
|
|
194
|
+
avatarUrl: 'https://example.com/avatar.jpg',
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<Stack.Screen
|
|
199
|
+
name="Settings"
|
|
200
|
+
component={SettingsScreenWrapper}
|
|
201
|
+
initialParams={{ config, userProfile }}
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### With Custom Styling
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
function PrivacyStack() {
|
|
211
|
+
const customStyles = {
|
|
212
|
+
container: { backgroundColor: '#f5f5f5' },
|
|
213
|
+
content: { fontSize: 16, lineHeight: 24 },
|
|
214
|
+
header: { color: '#333' },
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<Stack.Screen
|
|
219
|
+
name="PrivacyPolicy"
|
|
220
|
+
component={LegalScreenWrapper}
|
|
221
|
+
initialParams={{
|
|
222
|
+
documentType: 'privacy-policy',
|
|
223
|
+
styles: customStyles,
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### With App Information
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
function AboutStack() {
|
|
234
|
+
const appInfo = {
|
|
235
|
+
name: 'My Application',
|
|
236
|
+
version: '2.0.0',
|
|
237
|
+
buildNumber: '200',
|
|
238
|
+
developer: 'My Company LLC',
|
|
239
|
+
contactEmail: 'support@example.com',
|
|
240
|
+
websiteUrl: 'https://example.com',
|
|
241
|
+
websiteDisplay: 'example.com',
|
|
242
|
+
moreAppsUrl: 'https://example.com/apps',
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<Stack.Screen
|
|
247
|
+
name="About"
|
|
248
|
+
component={AboutScreenWrapper}
|
|
249
|
+
initialParams={{ appInfo }}
|
|
250
|
+
/>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Navigation Patterns
|
|
256
|
+
|
|
257
|
+
### Modal Presentation
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
<Stack.Screen
|
|
261
|
+
name="Settings"
|
|
262
|
+
component={SettingsScreenWrapper}
|
|
263
|
+
options={{
|
|
264
|
+
presentation: 'modal',
|
|
265
|
+
headerShown: false,
|
|
266
|
+
cardStyle: { backgroundColor: 'transparent' },
|
|
267
|
+
}}
|
|
268
|
+
initialParams={{ showCloseButton: true }}
|
|
269
|
+
/>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Custom Header
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
<Stack.Screen
|
|
276
|
+
name="Appearance"
|
|
277
|
+
component={AppearanceScreen}
|
|
278
|
+
options={{
|
|
279
|
+
headerTitle: 'Appearance',
|
|
280
|
+
headerStyle: { backgroundColor: '#fff' },
|
|
281
|
+
headerTintColor: '#000',
|
|
282
|
+
headerTitleStyle: { fontWeight: 'bold' },
|
|
283
|
+
}}
|
|
284
|
+
/>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Nested Navigation
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
<Tab.Navigator>
|
|
291
|
+
<Tab.Screen name="Home" component={HomeScreen} />
|
|
292
|
+
<Tab.Screen
|
|
293
|
+
name="Settings"
|
|
294
|
+
options={{ headerShown: false }}
|
|
295
|
+
>
|
|
296
|
+
{() => (
|
|
297
|
+
<SettingsStack>
|
|
298
|
+
<Stack.Screen
|
|
299
|
+
name="Settings"
|
|
300
|
+
component={SettingsScreenWrapper}
|
|
301
|
+
options={{ headerShown: false }}
|
|
302
|
+
/>
|
|
303
|
+
<Stack.Screen
|
|
304
|
+
name="Appearance"
|
|
305
|
+
component={AppearanceScreen}
|
|
306
|
+
/>
|
|
307
|
+
</SettingsStack>
|
|
308
|
+
)}
|
|
309
|
+
</Tab.Screen>
|
|
310
|
+
</Tab.Navigator>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Best Practices
|
|
314
|
+
|
|
315
|
+
1. **Use Wrappers**: Always use screen wrappers for proper props injection
|
|
316
|
+
2. **Type Safety**: Use TypeScript for navigation params
|
|
317
|
+
3. **Initial Params**: Pass configuration via initialParams
|
|
318
|
+
4. **Header Options**: Configure headers appropriately per screen
|
|
319
|
+
5. **Presentation**: Use modal presentation for settings on iOS
|
|
320
|
+
6. **Consistency**: Maintain consistent navigation patterns
|
|
321
|
+
|
|
322
|
+
## Related
|
|
323
|
+
|
|
324
|
+
- **SettingsStackNavigator**: Main navigator component
|
|
325
|
+
- **Navigation Hooks**: Navigation utility hooks
|
|
326
|
+
- **Screen Components**: Individual screen implementations
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
MIT
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
# Navigation Hooks
|
|
2
|
+
|
|
3
|
+
Custom React hooks for navigation utilities and helpers in the settings navigation system.
|
|
4
|
+
|
|
5
|
+
## Hooks
|
|
6
|
+
|
|
7
|
+
### useSettingsNavigation
|
|
8
|
+
|
|
9
|
+
Hook providing navigation utilities specific to the settings flow.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useSettingsNavigation } from '@umituz/react-native-settings';
|
|
13
|
+
|
|
14
|
+
function SettingsScreen() {
|
|
15
|
+
const { navigateToAppearance, navigateToLegal, navigateToAbout } = useSettingsNavigation();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Button onPress={() => navigateToAppearance()} title="Go to Appearance" />
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
interface SettingsNavigationHelpers {
|
|
27
|
+
navigateToAppearance: (config?: AppearanceConfig) => void;
|
|
28
|
+
navigateToLanguage: (config?: LanguageConfig) => void;
|
|
29
|
+
navigateToNotifications: (config?: NotificationsConfig) => void;
|
|
30
|
+
navigateToAbout: (config?: AboutConfig) => void;
|
|
31
|
+
navigateToLegal: (documentType: LegalDocumentType) => void;
|
|
32
|
+
navigateToFeedback: (config?: FeedbackConfig) => void;
|
|
33
|
+
navigateToFAQs: (config?: FAQConfig) => void;
|
|
34
|
+
navigateToSubscription: (config?: SubscriptionConfig) => void;
|
|
35
|
+
navigateToWallet: (config?: WalletConfig) => void;
|
|
36
|
+
goBack: () => void;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Navigation Helpers
|
|
41
|
+
|
|
42
|
+
### Appearance Navigation
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
navigateToAppearance(config?: {
|
|
46
|
+
showThemeSection?: boolean;
|
|
47
|
+
showColorsSection?: boolean;
|
|
48
|
+
showPreviewSection?: boolean;
|
|
49
|
+
}): void;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Navigates to the Appearance settings screen with optional configuration.
|
|
53
|
+
|
|
54
|
+
#### Example
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<Button
|
|
58
|
+
onPress={() => navigateToAppearance({
|
|
59
|
+
showThemeSection: true,
|
|
60
|
+
showColorsSection: true,
|
|
61
|
+
})}
|
|
62
|
+
title="Customize Appearance"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Language Navigation
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
navigateToLanguage(config?: {
|
|
70
|
+
showFlags?: boolean;
|
|
71
|
+
}): void;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Navigates to the Language selection screen.
|
|
75
|
+
|
|
76
|
+
#### Example
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Button
|
|
80
|
+
onPress={() => navigateToLanguage({ showFlags: true })}
|
|
81
|
+
title="Change Language"
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Legal Navigation
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
navigateToLegal(documentType: 'privacy-policy' | 'terms-of-service' | 'eula'): void;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Navigates to legal document screens.
|
|
92
|
+
|
|
93
|
+
#### Example
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<TouchableOpacity onPress={() => navigateToLegal('privacy-policy')}>
|
|
97
|
+
<Text>Privacy Policy</Text>
|
|
98
|
+
</TouchableOpacity>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### About Navigation
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
navigateToAbout(config?: {
|
|
105
|
+
appName?: string;
|
|
106
|
+
version?: string;
|
|
107
|
+
developer?: string;
|
|
108
|
+
contactEmail?: string;
|
|
109
|
+
}): void;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Navigates to the About screen with app information.
|
|
113
|
+
|
|
114
|
+
#### Example
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<Button
|
|
118
|
+
onPress={() => navigateToAbout({
|
|
119
|
+
appName: 'My App',
|
|
120
|
+
version: '1.0.0',
|
|
121
|
+
})}
|
|
122
|
+
title="About"
|
|
123
|
+
/>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Feedback Navigation
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
navigateToFeedback(config?: {
|
|
130
|
+
feedbackTypes?: FeedbackType[];
|
|
131
|
+
title?: string;
|
|
132
|
+
description?: string;
|
|
133
|
+
}): void;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Opens the feedback modal or navigates to feedback screen.
|
|
137
|
+
|
|
138
|
+
#### Example
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<Button
|
|
142
|
+
onPress={() => navigateToFeedback({
|
|
143
|
+
feedbackTypes: ['bug', 'feature', 'general'],
|
|
144
|
+
title: 'Send Feedback',
|
|
145
|
+
})}
|
|
146
|
+
title="Give Feedback"
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### FAQ Navigation
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
navigateToFAQs(config?: {
|
|
154
|
+
categories?: FAQCategory[];
|
|
155
|
+
title?: string;
|
|
156
|
+
}): void;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Navigates to the FAQ screen.
|
|
160
|
+
|
|
161
|
+
#### Example
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
<Button
|
|
165
|
+
onPress={() => navigateToFAQs({
|
|
166
|
+
title: 'Help Center',
|
|
167
|
+
})}
|
|
168
|
+
title="FAQs"
|
|
169
|
+
/>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Subscription Navigation
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
navigateToSubscription(config?: {
|
|
176
|
+
title?: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
onPress?: () => void;
|
|
179
|
+
}): void;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Navigates to subscription or upgrade screen.
|
|
183
|
+
|
|
184
|
+
#### Example
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<Button
|
|
188
|
+
onPress={() => navigateToSubscription({
|
|
189
|
+
title: 'Upgrade to Pro',
|
|
190
|
+
description: 'Get all premium features',
|
|
191
|
+
})}
|
|
192
|
+
title="Upgrade"
|
|
193
|
+
/>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Wallet Navigation
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
navigateToWallet(config?: {
|
|
200
|
+
title?: string;
|
|
201
|
+
description?: string;
|
|
202
|
+
route?: string;
|
|
203
|
+
}): void;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Navigates to wallet/payment settings.
|
|
207
|
+
|
|
208
|
+
#### Example
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
<Button
|
|
212
|
+
onPress={() => navigateToWallet({
|
|
213
|
+
title: 'My Wallet',
|
|
214
|
+
route: 'WalletScreen',
|
|
215
|
+
})}
|
|
216
|
+
title="Wallet"
|
|
217
|
+
/>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Usage Examples
|
|
221
|
+
|
|
222
|
+
### Basic Navigation
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { useSettingsNavigation } from '@umituz/react-native-settings';
|
|
226
|
+
|
|
227
|
+
function SettingsMenu() {
|
|
228
|
+
const { navigateToAppearance, navigateToAbout, navigateToLegal } = useSettingsNavigation();
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<View>
|
|
232
|
+
<SettingsItemCard
|
|
233
|
+
icon="color-palette-outline"
|
|
234
|
+
title="Appearance"
|
|
235
|
+
onPress={navigateToAppearance}
|
|
236
|
+
/>
|
|
237
|
+
<SettingsItemCard
|
|
238
|
+
icon="information-circle-outline"
|
|
239
|
+
title="About"
|
|
240
|
+
onPress={navigateToAbout}
|
|
241
|
+
/>
|
|
242
|
+
<SettingsItemCard
|
|
243
|
+
icon="document-text-outline"
|
|
244
|
+
title="Legal"
|
|
245
|
+
onPress={() => navigateToLegal('privacy-policy')}
|
|
246
|
+
/>
|
|
247
|
+
</View>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### With Configuration
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
function SettingsWithOptions() {
|
|
256
|
+
const { navigateToAppearance, navigateToLanguage } = useSettingsNavigation();
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<View>
|
|
260
|
+
<SettingsItemCard
|
|
261
|
+
icon="moon-outline"
|
|
262
|
+
title="Theme"
|
|
263
|
+
onPress={() => navigateToAppearance({
|
|
264
|
+
showThemeSection: true,
|
|
265
|
+
showColorsSection: false,
|
|
266
|
+
})}
|
|
267
|
+
/>
|
|
268
|
+
<SettingsItemCard
|
|
269
|
+
icon="globe-outline"
|
|
270
|
+
title="Language"
|
|
271
|
+
onPress={() => navigateToLanguage({ showFlags: true })}
|
|
272
|
+
/>
|
|
273
|
+
</View>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Conditional Navigation
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
function ConditionalNavigation() {
|
|
282
|
+
const { navigateToSubscription, navigateToFeedback } = useSettingsNavigation();
|
|
283
|
+
const isPremium = useIsPremium();
|
|
284
|
+
|
|
285
|
+
return (
|
|
286
|
+
<View>
|
|
287
|
+
{!isPremium && (
|
|
288
|
+
<SettingsItemCard
|
|
289
|
+
icon="star-outline"
|
|
290
|
+
title="Upgrade"
|
|
291
|
+
onPress={() => navigateToSubscription({
|
|
292
|
+
title: 'Go Premium',
|
|
293
|
+
description: 'Unlock all features',
|
|
294
|
+
})}
|
|
295
|
+
/>
|
|
296
|
+
)}
|
|
297
|
+
<SettingsItemCard
|
|
298
|
+
icon="chatbubble-outline"
|
|
299
|
+
title="Send Feedback"
|
|
300
|
+
onPress={() => navigateToFeedback({
|
|
301
|
+
feedbackTypes: ['bug', 'feature'],
|
|
302
|
+
})}
|
|
303
|
+
/>
|
|
304
|
+
</View>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Custom Navigation Handler
|
|
310
|
+
|
|
311
|
+
```tsx
|
|
312
|
+
function CustomNavigation() {
|
|
313
|
+
const { navigateToAppearance } = useSettingsNavigation();
|
|
314
|
+
|
|
315
|
+
const handleAppearancePress = useCallback(() => {
|
|
316
|
+
// Custom logic before navigation
|
|
317
|
+
Analytics.track('appearance_opened');
|
|
318
|
+
navigateToAppearance({ showThemeSection: true });
|
|
319
|
+
}, [navigateToAppearance]);
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<Button onPress={handleAppearancePress} title="Appearance" />
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Navigation Parameters
|
|
328
|
+
|
|
329
|
+
### Appearance Config
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
interface AppearanceNavConfig {
|
|
333
|
+
showThemeSection?: boolean; // Show theme mode selection
|
|
334
|
+
showColorsSection?: boolean; // Show custom color selection
|
|
335
|
+
showPreviewSection?: boolean; // Show live preview
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Language Config
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
interface LanguageNavConfig {
|
|
343
|
+
showFlags?: boolean; // Show language flags
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Legal Config
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
type LegalDocumentType =
|
|
351
|
+
| 'privacy-policy'
|
|
352
|
+
| 'terms-of-service'
|
|
353
|
+
| 'eula';
|
|
354
|
+
|
|
355
|
+
interface LegalNavConfig {
|
|
356
|
+
documentType: LegalDocumentType;
|
|
357
|
+
content?: string; // Custom content
|
|
358
|
+
title?: string; // Custom title
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Feedback Config
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
interface FeedbackNavConfig {
|
|
366
|
+
feedbackTypes?: FeedbackType[];
|
|
367
|
+
title?: string;
|
|
368
|
+
description?: string;
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### FAQ Config
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
interface FAQNavConfig {
|
|
376
|
+
categories?: FAQCategory[];
|
|
377
|
+
title?: string;
|
|
378
|
+
description?: string;
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Best Practices
|
|
383
|
+
|
|
384
|
+
1. **Type Safety**: Always use proper TypeScript types for config
|
|
385
|
+
2. **Memoization**: Memoize navigation handlers for performance
|
|
386
|
+
3. **Analytics**: Track navigation events for insights
|
|
387
|
+
4. **Conditional**: Use conditional navigation based on user state
|
|
388
|
+
5. **Validation**: Validate config before navigation
|
|
389
|
+
6. **Error Handling**: Handle navigation errors gracefully
|
|
390
|
+
|
|
391
|
+
## Related
|
|
392
|
+
|
|
393
|
+
- **Navigation Components**: Screen wrappers and components
|
|
394
|
+
- **Navigation Utils**: Utility functions for navigation
|
|
395
|
+
- **Screen Components**: Individual screen implementations
|
|
396
|
+
|
|
397
|
+
## License
|
|
398
|
+
|
|
399
|
+
MIT
|