@umituz/react-native-settings 4.23.6 → 4.23.8
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/package.json +1 -1
- package/src/domains/about/presentation/components/AboutSection.tsx +2 -0
- package/src/domains/appearance/presentation/components/AppearanceSection.tsx +2 -0
- package/src/domains/feedback/presentation/components/SupportSection.tsx +2 -1
- package/src/domains/legal/presentation/components/LegalSection.tsx +2 -0
- package/src/domains/notifications/presentation/components/NotificationsSection.tsx +8 -3
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +6 -2
- package/src/presentation/screens/types/ContentConfig.ts +2 -0
- package/src/presentation/utils/configCreators.ts +30 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.8",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -63,9 +63,10 @@ export const SupportSection: React.FC<SupportSectionProps> = ({
|
|
|
63
63
|
const handleFeedbackSubmit = async (data: { type: any; rating: number; description: string; title: string }) => {
|
|
64
64
|
if (feedbackConfig.config?.onSubmit) {
|
|
65
65
|
setIsSubmitting(true);
|
|
66
|
+
setModalVisible(false);
|
|
66
67
|
try {
|
|
68
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
67
69
|
await feedbackConfig.config.onSubmit(data);
|
|
68
|
-
setModalVisible(false);
|
|
69
70
|
} catch {
|
|
70
71
|
// Silent error handling
|
|
71
72
|
} finally {
|
|
@@ -13,6 +13,7 @@ import { useLocalization } from '@umituz/react-native-localization';
|
|
|
13
13
|
|
|
14
14
|
export interface NotificationsSectionConfig {
|
|
15
15
|
route?: string;
|
|
16
|
+
onPress?: () => void;
|
|
16
17
|
title?: string;
|
|
17
18
|
description?: string;
|
|
18
19
|
sectionTitle?: string;
|
|
@@ -33,9 +34,13 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
33
34
|
const styles = useMemo(() => createStyles(tokens), [tokens]);
|
|
34
35
|
|
|
35
36
|
const handlePress = useCallback(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (config?.onPress) {
|
|
38
|
+
config.onPress();
|
|
39
|
+
} else {
|
|
40
|
+
const route = config?.route || 'Notifications';
|
|
41
|
+
navigation.navigate(route as never);
|
|
42
|
+
}
|
|
43
|
+
}, [config?.route, config?.onPress, navigation]);
|
|
39
44
|
|
|
40
45
|
const title = config?.title || t('settings.notifications.title');
|
|
41
46
|
const description = config?.description || t('settings.notifications.description');
|
|
@@ -23,8 +23,12 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
23
23
|
const navigation = useAppNavigation();
|
|
24
24
|
|
|
25
25
|
const handleLanguagePress = () => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (normalizedConfig.language.config?.onPress) {
|
|
27
|
+
normalizedConfig.language.config.onPress();
|
|
28
|
+
} else {
|
|
29
|
+
const route = normalizedConfig.language.config?.route || "LanguageSelection";
|
|
30
|
+
navigation.navigate(route as never);
|
|
31
|
+
}
|
|
28
32
|
};
|
|
29
33
|
|
|
30
34
|
const currentLanguageData = getLanguageByCode(currentLanguage);
|
|
@@ -14,6 +14,8 @@ interface BaseContentConfig {
|
|
|
14
14
|
enabled?: FeatureVisibility;
|
|
15
15
|
/** Custom navigation route */
|
|
16
16
|
route?: string;
|
|
17
|
+
/** Custom navigation handler (overrides route) */
|
|
18
|
+
onPress?: () => void;
|
|
17
19
|
/** Custom title */
|
|
18
20
|
title?: string;
|
|
19
21
|
/** Custom description */
|
|
@@ -30,30 +30,44 @@ export type TranslationFunction = (key: string) => string;
|
|
|
30
30
|
/**
|
|
31
31
|
* Create appearance configuration
|
|
32
32
|
*/
|
|
33
|
-
export const createAppearanceConfig = (
|
|
33
|
+
export const createAppearanceConfig = (
|
|
34
|
+
t: TranslationFunction,
|
|
35
|
+
routeOrOnPress?: string | (() => void),
|
|
36
|
+
): AppearanceConfig => ({
|
|
34
37
|
enabled: true,
|
|
35
38
|
title: t("settings.appearance.title"),
|
|
36
39
|
description: t("settings.appearance.description"),
|
|
37
40
|
icon: "color-palette-outline",
|
|
41
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
42
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
38
43
|
});
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
46
|
* Create language configuration
|
|
42
47
|
*/
|
|
43
|
-
export const createLanguageConfig = (
|
|
48
|
+
export const createLanguageConfig = (
|
|
49
|
+
t: TranslationFunction,
|
|
50
|
+
routeOrOnPress?: string | (() => void),
|
|
51
|
+
): LanguageConfig => ({
|
|
44
52
|
enabled: true,
|
|
45
53
|
title: t("settings.language.title"),
|
|
46
54
|
description: t("settings.language.description"),
|
|
47
55
|
icon: "globe-outline",
|
|
56
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
57
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
48
58
|
});
|
|
49
59
|
|
|
50
60
|
/**
|
|
51
61
|
* Create notifications configuration
|
|
52
62
|
*/
|
|
53
|
-
export const createNotificationsConfig = (
|
|
63
|
+
export const createNotificationsConfig = (
|
|
64
|
+
t: TranslationFunction,
|
|
65
|
+
routeOrOnPress?: string | (() => void),
|
|
66
|
+
): NotificationsConfig => ({
|
|
54
67
|
enabled: true,
|
|
55
68
|
showToggle: false,
|
|
56
|
-
route: "Notifications",
|
|
69
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : "Notifications",
|
|
70
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
57
71
|
title: t("settings.notifications.title"),
|
|
58
72
|
description: t("settings.notifications.description"),
|
|
59
73
|
sectionTitle: t("settings.notifications.sectionTitle"),
|
|
@@ -63,21 +77,31 @@ export const createNotificationsConfig = (t: TranslationFunction): Notifications
|
|
|
63
77
|
/**
|
|
64
78
|
* Create about configuration
|
|
65
79
|
*/
|
|
66
|
-
export const createAboutConfig = (
|
|
80
|
+
export const createAboutConfig = (
|
|
81
|
+
t: TranslationFunction,
|
|
82
|
+
routeOrOnPress?: string | (() => void),
|
|
83
|
+
): AboutConfig => ({
|
|
67
84
|
enabled: true,
|
|
68
85
|
title: t("settings.about.title"),
|
|
69
86
|
description: t("settings.about.description"),
|
|
70
87
|
icon: "information-circle-outline",
|
|
88
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
89
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
71
90
|
});
|
|
72
91
|
|
|
73
92
|
/**
|
|
74
93
|
* Create legal configuration
|
|
75
94
|
*/
|
|
76
|
-
export const createLegalConfig = (
|
|
95
|
+
export const createLegalConfig = (
|
|
96
|
+
t: TranslationFunction,
|
|
97
|
+
routeOrOnPress?: string | (() => void),
|
|
98
|
+
): LegalConfig => ({
|
|
77
99
|
enabled: true,
|
|
78
100
|
title: t("settings.legal.title"),
|
|
79
101
|
description: t("settings.legal.description"),
|
|
80
102
|
icon: "document-text-outline",
|
|
103
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
104
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
81
105
|
});
|
|
82
106
|
|
|
83
107
|
/**
|