@umituz/react-native-settings 4.1.6 → 4.3.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
|
@@ -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}>
|
|
@@ -25,6 +25,11 @@ export interface SettingsStackNavigatorProps {
|
|
|
25
25
|
*/
|
|
26
26
|
config?: SettingsConfig;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* App version number from app config (e.g., "1.0.0")
|
|
30
|
+
*/
|
|
31
|
+
appVersion?: string;
|
|
32
|
+
|
|
28
33
|
/**
|
|
29
34
|
* Additional screens to register
|
|
30
35
|
* Apps can add their own screens here
|
|
@@ -40,6 +45,7 @@ const Stack = createStackNavigator<SettingsStackParamList>();
|
|
|
40
45
|
|
|
41
46
|
export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
42
47
|
config = {},
|
|
48
|
+
appVersion,
|
|
43
49
|
additionalScreens = [],
|
|
44
50
|
}) => {
|
|
45
51
|
const tokens = useAppDesignTokens();
|
|
@@ -60,10 +66,10 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
60
66
|
|
|
61
67
|
// Memoize SettingsScreen wrapper to prevent remounting on every render
|
|
62
68
|
const SettingsScreenWrapper = React.useMemo(() => {
|
|
63
|
-
const Wrapper = () => <SettingsScreen config={config} />;
|
|
69
|
+
const Wrapper = () => <SettingsScreen config={config} appVersion={appVersion} />;
|
|
64
70
|
Wrapper.displayName = "SettingsScreenWrapper";
|
|
65
71
|
return Wrapper;
|
|
66
|
-
}, [config]);
|
|
72
|
+
}, [config, appVersion]);
|
|
67
73
|
|
|
68
74
|
return (
|
|
69
75
|
<Stack.Navigator screenOptions={screenOptions}>
|
|
@@ -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
|
};
|