@umituz/react-native-settings 4.1.5 → 4.2.0
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.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -90,4 +90,4 @@
|
|
|
90
90
|
"README.md",
|
|
91
91
|
"LICENSE"
|
|
92
92
|
]
|
|
93
|
-
}
|
|
93
|
+
}
|
|
@@ -9,20 +9,30 @@ import { useLocalization } from "@umituz/react-native-localization";
|
|
|
9
9
|
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
10
10
|
|
|
11
11
|
export interface SettingsFooterProps {
|
|
12
|
-
/** Custom version text (optional) */
|
|
12
|
+
/** Custom version text (optional) - should include version number from app config */
|
|
13
13
|
versionText?: string;
|
|
14
|
+
/** App version number from app config (e.g., "1.0.0") */
|
|
15
|
+
appVersion?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const SettingsFooter: React.FC<SettingsFooterProps> = ({
|
|
17
19
|
versionText,
|
|
20
|
+
appVersion,
|
|
18
21
|
}) => {
|
|
19
22
|
const { t } = useLocalization();
|
|
20
23
|
const tokens = useAppDesignTokens();
|
|
21
24
|
const colors = tokens.colors;
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
// If versionText is provided, use it directly
|
|
27
|
+
// Otherwise build from translated label + appVersion
|
|
28
|
+
const displayText = versionText || (appVersion
|
|
29
|
+
? `${t("settings.footer.version")} ${appVersion}`
|
|
30
|
+
: undefined);
|
|
31
|
+
|
|
32
|
+
// Don't render if no version info available
|
|
33
|
+
if (!displayText) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
26
36
|
|
|
27
37
|
return (
|
|
28
38
|
<View style={styles.container}>
|
|
@@ -58,17 +58,23 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
58
58
|
headerTintColor: tokens.colors.textPrimary,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
// Memoize SettingsScreen wrapper to prevent remounting on every render
|
|
62
|
+
const SettingsScreenWrapper = React.useMemo(() => {
|
|
63
|
+
const Wrapper = () => <SettingsScreen config={config} />;
|
|
64
|
+
Wrapper.displayName = "SettingsScreenWrapper";
|
|
65
|
+
return Wrapper;
|
|
66
|
+
}, [config]);
|
|
67
|
+
|
|
61
68
|
return (
|
|
62
69
|
<Stack.Navigator screenOptions={screenOptions}>
|
|
63
70
|
<Stack.Screen
|
|
64
71
|
name="Settings"
|
|
72
|
+
component={SettingsScreenWrapper}
|
|
65
73
|
options={{
|
|
66
74
|
headerShown: false,
|
|
67
75
|
title: "Settings",
|
|
68
76
|
}}
|
|
69
|
-
|
|
70
|
-
{() => <SettingsScreen config={config} />}
|
|
71
|
-
</Stack.Screen>
|
|
77
|
+
/>
|
|
72
78
|
|
|
73
79
|
<Stack.Screen
|
|
74
80
|
name="Appearance"
|
|
@@ -34,8 +34,10 @@ export interface SettingsScreenProps {
|
|
|
34
34
|
};
|
|
35
35
|
/** Show footer with version */
|
|
36
36
|
showFooter?: boolean;
|
|
37
|
-
/** Custom footer text */
|
|
37
|
+
/** Custom footer text (overrides appVersion) */
|
|
38
38
|
footerText?: string;
|
|
39
|
+
/** App version number from app config (e.g., "1.0.0") */
|
|
40
|
+
appVersion?: string;
|
|
39
41
|
/** Custom sections to render */
|
|
40
42
|
customSections?: CustomSettingsSection[];
|
|
41
43
|
/** Show close button in header */
|
|
@@ -54,6 +56,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
54
56
|
userProfile,
|
|
55
57
|
showFooter = true,
|
|
56
58
|
footerText,
|
|
59
|
+
appVersion,
|
|
57
60
|
customSections = [],
|
|
58
61
|
showCloseButton = false,
|
|
59
62
|
onClose,
|
|
@@ -72,9 +75,9 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
72
75
|
return (
|
|
73
76
|
<View style={[styles.container, { backgroundColor: colors.backgroundPrimary }]}>
|
|
74
77
|
<StatusBar barStyle={isDark ? "light-content" : "dark-content"} />
|
|
75
|
-
|
|
78
|
+
|
|
76
79
|
<SettingsHeader showCloseButton={showCloseButton} onClose={onClose} />
|
|
77
|
-
|
|
80
|
+
|
|
78
81
|
<SettingsErrorBoundary>
|
|
79
82
|
<SettingsContent
|
|
80
83
|
normalizedConfig={normalizedConfig}
|
|
@@ -83,6 +86,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
83
86
|
userProfile={userProfile}
|
|
84
87
|
showFooter={showFooter}
|
|
85
88
|
footerText={footerText}
|
|
89
|
+
appVersion={appVersion}
|
|
86
90
|
customSections={customSections}
|
|
87
91
|
showCloseButton={showCloseButton}
|
|
88
92
|
/>
|
|
@@ -42,6 +42,7 @@ interface SettingsContentProps {
|
|
|
42
42
|
};
|
|
43
43
|
showFooter?: boolean;
|
|
44
44
|
footerText?: string;
|
|
45
|
+
appVersion?: string;
|
|
45
46
|
customSections?: CustomSettingsSection[];
|
|
46
47
|
showCloseButton?: boolean;
|
|
47
48
|
}
|
|
@@ -54,6 +55,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
54
55
|
userProfile,
|
|
55
56
|
showFooter = true,
|
|
56
57
|
footerText,
|
|
58
|
+
appVersion,
|
|
57
59
|
customSections = [],
|
|
58
60
|
showCloseButton = false,
|
|
59
61
|
}) => {
|
|
@@ -145,7 +147,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
145
147
|
</View>
|
|
146
148
|
)}
|
|
147
149
|
|
|
148
|
-
{showFooter && <SettingsFooter versionText={footerText} />}
|
|
150
|
+
{showFooter && <SettingsFooter versionText={footerText} appVersion={appVersion} />}
|
|
149
151
|
</ScrollView>
|
|
150
152
|
);
|
|
151
153
|
};
|