@umituz/react-native-settings 4.21.9 → 4.21.10
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.10",
|
|
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",
|
|
@@ -34,6 +34,26 @@ const WalletSettingsItem: React.FC<{ config: WalletConfig; t: (key: string) => s
|
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const SubscriptionSettingsItem: React.FC<{ config: any; t: (key: string) => string }> = ({ config, t }) => {
|
|
38
|
+
const navigation = useNavigation();
|
|
39
|
+
const handlePress = () => {
|
|
40
|
+
if (config.route) {
|
|
41
|
+
navigation.navigate(config.route as never);
|
|
42
|
+
} else if (config.onPress) {
|
|
43
|
+
config.onPress();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (
|
|
47
|
+
<SettingsItemCard
|
|
48
|
+
title={config.title || t("settings.subscription.title")}
|
|
49
|
+
description={config.description || t("settings.subscription.description")}
|
|
50
|
+
icon={(config.icon || "star") as IconName}
|
|
51
|
+
onPress={handlePress}
|
|
52
|
+
sectionTitle={config.sectionTitle}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
37
57
|
interface SettingsContentProps {
|
|
38
58
|
normalizedConfig: NormalizedConfig;
|
|
39
59
|
config?: any;
|
|
@@ -98,14 +118,8 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
98
118
|
|
|
99
119
|
<CustomSettingsList customSections={customSections} />
|
|
100
120
|
|
|
101
|
-
{features.subscription && normalizedConfig.subscription.config?.onPress && (
|
|
102
|
-
<
|
|
103
|
-
title={normalizedConfig.subscription.config.title || t("settings.subscription.title")}
|
|
104
|
-
description={normalizedConfig.subscription.config.description || t("settings.subscription.description")}
|
|
105
|
-
icon={(normalizedConfig.subscription.config.icon || "star") as IconName}
|
|
106
|
-
onPress={normalizedConfig.subscription.config.onPress}
|
|
107
|
-
sectionTitle={normalizedConfig.subscription.config.sectionTitle}
|
|
108
|
-
/>
|
|
121
|
+
{features.subscription && (normalizedConfig.subscription.config?.route || normalizedConfig.subscription.config?.onPress) && (
|
|
122
|
+
<SubscriptionSettingsItem config={normalizedConfig.subscription.config} t={t} />
|
|
109
123
|
)}
|
|
110
124
|
|
|
111
125
|
{features.wallet && normalizedConfig.wallet.config?.route && (
|
|
@@ -112,7 +112,9 @@ export interface SubscriptionConfig {
|
|
|
112
112
|
icon?: string;
|
|
113
113
|
/** Custom section title for grouping */
|
|
114
114
|
sectionTitle?: string;
|
|
115
|
-
/**
|
|
115
|
+
/** Navigation route for subscription screen (preferred over onPress) */
|
|
116
|
+
route?: string;
|
|
117
|
+
/** Handler to open subscription screen (use route instead for stack navigation) */
|
|
116
118
|
onPress?: () => void;
|
|
117
119
|
/** Whether user is premium (to show active status) */
|
|
118
120
|
isPremium?: boolean;
|
|
@@ -130,11 +130,13 @@ export const createFAQConfig = (
|
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Create subscription configuration
|
|
133
|
+
* @param route - Navigation route name (preferred for stack navigation)
|
|
134
|
+
* @param onPress - Callback function (use route instead when possible)
|
|
133
135
|
*/
|
|
134
136
|
export const createSubscriptionConfig = (
|
|
135
137
|
t: TranslationFunction,
|
|
136
138
|
isPremium: boolean,
|
|
137
|
-
|
|
139
|
+
routeOrOnPress: string | (() => void),
|
|
138
140
|
): SubscriptionConfig => ({
|
|
139
141
|
enabled: true,
|
|
140
142
|
title: t("settings.subscription.title"),
|
|
@@ -143,6 +145,7 @@ export const createSubscriptionConfig = (
|
|
|
143
145
|
: t("settings.subscription.description"),
|
|
144
146
|
icon: "diamond",
|
|
145
147
|
sectionTitle: t("settings.sections.subscription").toUpperCase(),
|
|
146
|
-
|
|
148
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
149
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
147
150
|
isPremium,
|
|
148
151
|
});
|