@umituz/react-native-settings 4.23.7 → 4.23.9
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/dev/presentation/components/EnvViewerSetting.tsx +9 -2
- package/src/domains/dev/presentation/screens/EnvViewerScreen.tsx +3 -2
- 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.9",
|
|
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",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React from "react";
|
|
8
|
-
import { useAppDesignTokens,
|
|
8
|
+
import { useAppDesignTokens, useAppNavigation } from "@umituz/react-native-design-system";
|
|
9
9
|
import { SettingsItemCard } from "../../../../presentation/components/SettingsItemCard";
|
|
10
10
|
import type { EnvConfig } from "../../types";
|
|
11
11
|
|
|
@@ -18,6 +18,8 @@ export interface EnvViewerSettingProps {
|
|
|
18
18
|
description?: string;
|
|
19
19
|
/** Screen name to navigate to */
|
|
20
20
|
screenName: string;
|
|
21
|
+
/** Custom navigation handler (overrides route) */
|
|
22
|
+
onPress?: () => void;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export const EnvViewerSetting: React.FC<EnvViewerSettingProps> = ({
|
|
@@ -27,9 +29,14 @@ export const EnvViewerSetting: React.FC<EnvViewerSettingProps> = ({
|
|
|
27
29
|
screenName,
|
|
28
30
|
}) => {
|
|
29
31
|
const tokens = useAppDesignTokens();
|
|
32
|
+
const navigation = useAppNavigation();
|
|
30
33
|
|
|
31
34
|
const handlePress = () => {
|
|
32
|
-
|
|
35
|
+
if (onPress) {
|
|
36
|
+
onPress();
|
|
37
|
+
} else {
|
|
38
|
+
navigation.navigate(screenName as any, { config } as any);
|
|
39
|
+
}
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
return (
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
AtomicTouchable,
|
|
13
13
|
useAppDesignTokens,
|
|
14
14
|
useSafeAreaInsets,
|
|
15
|
-
|
|
15
|
+
useAppNavigation,
|
|
16
16
|
AlertService,
|
|
17
17
|
NavigationHeader,
|
|
18
18
|
} from "@umituz/react-native-design-system";
|
|
@@ -27,6 +27,7 @@ export interface EnvViewerScreenProps {
|
|
|
27
27
|
export const EnvViewerScreen: React.FC<EnvViewerScreenProps> = ({ config }) => {
|
|
28
28
|
const tokens = useAppDesignTokens();
|
|
29
29
|
const { bottom } = useSafeAreaInsets();
|
|
30
|
+
const navigation = useAppNavigation();
|
|
30
31
|
const [revealedKeys, setRevealedKeys] = useState<Set<string>>(new Set());
|
|
31
32
|
|
|
32
33
|
const toggleReveal = (key: string) => {
|
|
@@ -95,7 +96,7 @@ export const EnvViewerScreen: React.FC<EnvViewerScreenProps> = ({ config }) => {
|
|
|
95
96
|
|
|
96
97
|
return (
|
|
97
98
|
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
98
|
-
<NavigationHeader title="Environment Variables" onBackPress={() =>
|
|
99
|
+
<NavigationHeader title="Environment Variables" onBackPress={() => navigation.goBack()} />
|
|
99
100
|
|
|
100
101
|
<ScrollView
|
|
101
102
|
showsVerticalScrollIndicator={false}
|
|
@@ -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
|
/**
|