@umituz/react-native-settings 4.23.27 → 4.23.29
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 +9 -0
- package/src/domains/appearance/presentation/components/AppearanceSection.tsx +9 -0
- package/src/domains/legal/presentation/components/LegalSection.tsx +9 -0
- package/src/domains/notifications/presentation/components/NotificationsSection.tsx +16 -48
- package/src/presentation/components/SettingsItemCard.tsx +11 -2
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +20 -6
- package/src/presentation/screens/components/sections/IdentitySettingsSection.tsx +12 -4
- package/src/presentation/screens/components/sections/SupportSettingsSection.tsx +12 -1
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.29",
|
|
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",
|
|
@@ -11,8 +11,11 @@ export interface AboutSectionProps {
|
|
|
11
11
|
title?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
sectionTitle?: string;
|
|
14
|
+
noBackground?: boolean;
|
|
15
|
+
hideMargin?: boolean;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
|
|
16
19
|
export const AboutSection: React.FC<AboutSectionProps> = ({
|
|
17
20
|
config,
|
|
18
21
|
onPress,
|
|
@@ -20,7 +23,10 @@ export const AboutSection: React.FC<AboutSectionProps> = ({
|
|
|
20
23
|
title: propsTitle,
|
|
21
24
|
description: propsDescription,
|
|
22
25
|
sectionTitle: propsSectionTitle,
|
|
26
|
+
noBackground,
|
|
27
|
+
hideMargin,
|
|
23
28
|
}) => {
|
|
29
|
+
|
|
24
30
|
const navigation = useAppNavigation();
|
|
25
31
|
|
|
26
32
|
const route = config?.route || config?.defaultRoute || 'About';
|
|
@@ -48,6 +54,9 @@ export const AboutSection: React.FC<AboutSectionProps> = ({
|
|
|
48
54
|
onPress={handlePress}
|
|
49
55
|
containerStyle={containerStyle}
|
|
50
56
|
sectionTitle={sectionTitle}
|
|
57
|
+
noBackground={noBackground}
|
|
58
|
+
hideMargin={hideMargin}
|
|
51
59
|
/>
|
|
52
60
|
);
|
|
53
61
|
};
|
|
62
|
+
|
|
@@ -13,8 +13,11 @@ export interface AppearanceSectionProps {
|
|
|
13
13
|
title?: string;
|
|
14
14
|
/** Optional explicit description override */
|
|
15
15
|
description?: string;
|
|
16
|
+
noBackground?: boolean;
|
|
17
|
+
hideMargin?: boolean;
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
|
|
18
21
|
export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
19
22
|
config,
|
|
20
23
|
onPress,
|
|
@@ -22,7 +25,10 @@ export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
|
22
25
|
sectionTitle,
|
|
23
26
|
title: titleProp,
|
|
24
27
|
description: descriptionProp,
|
|
28
|
+
noBackground,
|
|
29
|
+
hideMargin,
|
|
25
30
|
}) => {
|
|
31
|
+
|
|
26
32
|
const navigation = useAppNavigation();
|
|
27
33
|
|
|
28
34
|
const route = config?.route || config?.defaultRoute || 'Appearance';
|
|
@@ -49,7 +55,10 @@ export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
|
49
55
|
onPress={handlePress}
|
|
50
56
|
containerStyle={containerStyle}
|
|
51
57
|
sectionTitle={sectionTitle}
|
|
58
|
+
noBackground={noBackground}
|
|
59
|
+
hideMargin={hideMargin}
|
|
52
60
|
/>
|
|
53
61
|
);
|
|
54
62
|
};
|
|
55
63
|
|
|
64
|
+
|
|
@@ -11,8 +11,11 @@ export interface LegalSectionProps {
|
|
|
11
11
|
title?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
sectionTitle?: string;
|
|
14
|
+
noBackground?: boolean;
|
|
15
|
+
hideMargin?: boolean;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
|
|
16
19
|
export const LegalSection: React.FC<LegalSectionProps> = ({
|
|
17
20
|
config,
|
|
18
21
|
onPress,
|
|
@@ -20,7 +23,10 @@ export const LegalSection: React.FC<LegalSectionProps> = ({
|
|
|
20
23
|
title: propsTitle,
|
|
21
24
|
description: propsDescription,
|
|
22
25
|
sectionTitle: propsSectionTitle,
|
|
26
|
+
noBackground,
|
|
27
|
+
hideMargin,
|
|
23
28
|
}) => {
|
|
29
|
+
|
|
24
30
|
const navigation = useAppNavigation();
|
|
25
31
|
|
|
26
32
|
const route = config?.route || config?.defaultRoute || 'Legal';
|
|
@@ -48,6 +54,9 @@ export const LegalSection: React.FC<LegalSectionProps> = ({
|
|
|
48
54
|
onPress={handlePress}
|
|
49
55
|
containerStyle={containerStyle}
|
|
50
56
|
sectionTitle={sectionTitle}
|
|
57
|
+
noBackground={noBackground}
|
|
58
|
+
hideMargin={hideMargin}
|
|
51
59
|
/>
|
|
52
60
|
);
|
|
53
61
|
};
|
|
62
|
+
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* NotificationsSection Component
|
|
3
|
-
* Settings section for notifications - navigates to full screen
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useCallback, useMemo } from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
7
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
import { AtomicText, AtomicIcon, useAppNavigation } from '@umituz/react-native-design-system';
|
|
10
|
-
import { useAppDesignTokens } from '@umituz/react-native-design-system';
|
|
11
|
-
// @ts-ignore - Optional peer dependency
|
|
3
|
+
import { useAppNavigation } from '@umituz/react-native-design-system';
|
|
12
4
|
import { useLocalization } from '@umituz/react-native-localization';
|
|
5
|
+
import { SettingsItemCard } from '../../../../presentation/components/SettingsItemCard';
|
|
13
6
|
|
|
14
7
|
export interface NotificationsSectionConfig {
|
|
15
8
|
route?: string;
|
|
@@ -22,16 +15,18 @@ export interface NotificationsSectionConfig {
|
|
|
22
15
|
export interface NotificationsSectionProps {
|
|
23
16
|
config?: NotificationsSectionConfig;
|
|
24
17
|
containerStyle?: StyleProp<ViewStyle>;
|
|
18
|
+
noBackground?: boolean;
|
|
19
|
+
hideMargin?: boolean;
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
28
23
|
config,
|
|
29
24
|
containerStyle,
|
|
25
|
+
noBackground,
|
|
26
|
+
hideMargin,
|
|
30
27
|
}) => {
|
|
31
28
|
const navigation = useAppNavigation();
|
|
32
29
|
const { t } = useLocalization();
|
|
33
|
-
const tokens = useAppDesignTokens();
|
|
34
|
-
const styles = useMemo(() => createStyles(tokens), [tokens]);
|
|
35
30
|
|
|
36
31
|
const handlePress = useCallback(() => {
|
|
37
32
|
if (config?.onPress) {
|
|
@@ -44,44 +39,17 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
44
39
|
|
|
45
40
|
const title = config?.title || t('settings.notifications.title');
|
|
46
41
|
const description = config?.description || t('settings.notifications.description');
|
|
47
|
-
const sectionTitle = config?.sectionTitle || t('settings.notifications.sectionTitle');
|
|
48
42
|
|
|
49
43
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<AtomicIcon name="notifications" size="md" color="primary" />
|
|
60
|
-
</View>
|
|
61
|
-
<View style={styles.textContainer}>
|
|
62
|
-
<AtomicText type="bodyLarge">{title}</AtomicText>
|
|
63
|
-
<AtomicText type="bodySmall" style={styles.description}>{description}</AtomicText>
|
|
64
|
-
</View>
|
|
65
|
-
<AtomicIcon name="chevron-forward" size="md" color="secondary" />
|
|
66
|
-
</TouchableOpacity>
|
|
67
|
-
</View>
|
|
44
|
+
<SettingsItemCard
|
|
45
|
+
title={title}
|
|
46
|
+
description={description}
|
|
47
|
+
icon="notifications"
|
|
48
|
+
onPress={handlePress}
|
|
49
|
+
containerStyle={containerStyle}
|
|
50
|
+
noBackground={noBackground}
|
|
51
|
+
hideMargin={hideMargin}
|
|
52
|
+
/>
|
|
68
53
|
);
|
|
69
54
|
};
|
|
70
55
|
|
|
71
|
-
const createStyles = (tokens: ReturnType<typeof useAppDesignTokens>) =>
|
|
72
|
-
StyleSheet.create({
|
|
73
|
-
container: { marginBottom: 16, borderRadius: 12, overflow: 'hidden', backgroundColor: tokens.colors.surface },
|
|
74
|
-
sectionTitle: { fontWeight: '600', paddingHorizontal: 16, paddingTop: 16, paddingBottom: 8 },
|
|
75
|
-
itemContainer: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, paddingVertical: 16, minHeight: 72 },
|
|
76
|
-
iconContainer: {
|
|
77
|
-
width: 48,
|
|
78
|
-
height: 48,
|
|
79
|
-
borderRadius: 12,
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
marginRight: 16,
|
|
83
|
-
backgroundColor: tokens.colors.surfaceSecondary,
|
|
84
|
-
},
|
|
85
|
-
textContainer: { flex: 1, marginRight: 8 },
|
|
86
|
-
description: { color: tokens.colors.textSecondary, marginTop: 4 },
|
|
87
|
-
});
|
|
@@ -24,8 +24,11 @@ export interface SettingsItemCardProps {
|
|
|
24
24
|
switchValue?: boolean;
|
|
25
25
|
onSwitchChange?: (value: boolean) => void;
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
noBackground?: boolean;
|
|
28
|
+
hideMargin?: boolean;
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
|
|
29
32
|
export const SettingsItemCard: React.FC<SettingsItemCardProps> = ({
|
|
30
33
|
title,
|
|
31
34
|
description,
|
|
@@ -41,7 +44,10 @@ export const SettingsItemCard: React.FC<SettingsItemCardProps> = ({
|
|
|
41
44
|
switchValue,
|
|
42
45
|
onSwitchChange,
|
|
43
46
|
disabled = false,
|
|
47
|
+
noBackground = false,
|
|
48
|
+
hideMargin = false,
|
|
44
49
|
}) => {
|
|
50
|
+
|
|
45
51
|
const tokens = useAppDesignTokens();
|
|
46
52
|
const colors = tokens.colors;
|
|
47
53
|
|
|
@@ -95,12 +101,15 @@ export const SettingsItemCard: React.FC<SettingsItemCardProps> = ({
|
|
|
95
101
|
style={[
|
|
96
102
|
styles.sectionContainer,
|
|
97
103
|
{
|
|
98
|
-
backgroundColor: colors.surface,
|
|
99
|
-
borderRadius: tokens.borders.radius.lg,
|
|
104
|
+
backgroundColor: noBackground ? "transparent" : colors.surface,
|
|
105
|
+
borderRadius: noBackground ? 0 : tokens.borders.radius.lg,
|
|
100
106
|
},
|
|
107
|
+
hideMargin && { marginBottom: 0 },
|
|
101
108
|
containerStyle,
|
|
102
109
|
]}
|
|
103
110
|
>
|
|
111
|
+
|
|
112
|
+
|
|
104
113
|
{!!sectionTitle && (
|
|
105
114
|
<View style={styles.headerContainer}>
|
|
106
115
|
<AtomicText type="labelMedium" color="textSecondary" style={{ textTransform: 'uppercase' }}>
|
|
@@ -6,6 +6,8 @@ import { useLocalization, getLanguageByCode } from "@umituz/react-native-localiz
|
|
|
6
6
|
import { SettingsItemCard } from "../../../components/SettingsItemCard";
|
|
7
7
|
import type { NormalizedConfig } from "../../utils/normalizeConfig";
|
|
8
8
|
|
|
9
|
+
import { SettingsSection } from "../../../components/SettingsSection";
|
|
10
|
+
|
|
9
11
|
interface FeatureSettingsSectionProps {
|
|
10
12
|
normalizedConfig: NormalizedConfig;
|
|
11
13
|
features: {
|
|
@@ -26,18 +28,24 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
26
28
|
if (normalizedConfig.language.config?.onPress) {
|
|
27
29
|
normalizedConfig.language.config.onPress();
|
|
28
30
|
} else {
|
|
29
|
-
const route =
|
|
31
|
+
const route =
|
|
32
|
+
normalizedConfig.language.config?.route || "LanguageSelection";
|
|
30
33
|
navigation.navigate(route as never);
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
const currentLanguageData = getLanguageByCode(currentLanguage);
|
|
35
|
-
const languageDisplayName = currentLanguageData
|
|
38
|
+
const languageDisplayName = currentLanguageData
|
|
36
39
|
? `${currentLanguageData.flag} ${currentLanguageData.nativeName}`
|
|
37
40
|
: currentLanguage;
|
|
38
41
|
|
|
42
|
+
if (!features.appearance && !features.language && !features.notifications)
|
|
43
|
+
return null;
|
|
44
|
+
|
|
39
45
|
return (
|
|
40
|
-
|
|
46
|
+
<SettingsSection
|
|
47
|
+
title={t("settings.sections.app.title") || t("settings.sections.app") || "App Settings"}
|
|
48
|
+
>
|
|
41
49
|
{features.appearance && (
|
|
42
50
|
<AppearanceSection
|
|
43
51
|
config={{
|
|
@@ -45,7 +53,8 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
45
53
|
title: t("settings.appearance.title"),
|
|
46
54
|
description: t("settings.appearance.description"),
|
|
47
55
|
}}
|
|
48
|
-
|
|
56
|
+
noBackground={true}
|
|
57
|
+
hideMargin={true}
|
|
49
58
|
/>
|
|
50
59
|
)}
|
|
51
60
|
|
|
@@ -55,7 +64,8 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
55
64
|
description={languageDisplayName}
|
|
56
65
|
icon="globe-outline"
|
|
57
66
|
onPress={handleLanguagePress}
|
|
58
|
-
|
|
67
|
+
noBackground={true}
|
|
68
|
+
hideMargin={true}
|
|
59
69
|
/>
|
|
60
70
|
)}
|
|
61
71
|
|
|
@@ -66,8 +76,12 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
66
76
|
title: t("settings.notifications.title"),
|
|
67
77
|
description: t("settings.notifications.description"),
|
|
68
78
|
}}
|
|
79
|
+
noBackground={true}
|
|
80
|
+
hideMargin={true}
|
|
69
81
|
/>
|
|
70
82
|
)}
|
|
71
|
-
|
|
83
|
+
|
|
84
|
+
</SettingsSection>
|
|
72
85
|
);
|
|
73
86
|
};
|
|
87
|
+
|
|
@@ -4,6 +4,8 @@ import { LegalSection } from "../../../../domains/legal/presentation/components/
|
|
|
4
4
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
5
5
|
import type { NormalizedConfig } from "../../utils/normalizeConfig";
|
|
6
6
|
|
|
7
|
+
import { SettingsSection } from "../../../components/SettingsSection";
|
|
8
|
+
|
|
7
9
|
interface IdentitySettingsSectionProps {
|
|
8
10
|
normalizedConfig: NormalizedConfig;
|
|
9
11
|
features: any;
|
|
@@ -15,8 +17,10 @@ export const IdentitySettingsSection: React.FC<IdentitySettingsSectionProps> = (
|
|
|
15
17
|
}) => {
|
|
16
18
|
const { t } = useLocalization();
|
|
17
19
|
|
|
20
|
+
if (!features.about && !features.legal) return null;
|
|
21
|
+
|
|
18
22
|
return (
|
|
19
|
-
|
|
23
|
+
<SettingsSection title={t("settings.about.title")}>
|
|
20
24
|
{features.about && (
|
|
21
25
|
<AboutSection
|
|
22
26
|
config={{
|
|
@@ -24,7 +28,8 @@ export const IdentitySettingsSection: React.FC<IdentitySettingsSectionProps> = (
|
|
|
24
28
|
title: t("settings.about.title"),
|
|
25
29
|
description: t("settings.about.description"),
|
|
26
30
|
}}
|
|
27
|
-
|
|
31
|
+
noBackground={true}
|
|
32
|
+
hideMargin={true}
|
|
28
33
|
/>
|
|
29
34
|
)}
|
|
30
35
|
|
|
@@ -35,9 +40,12 @@ export const IdentitySettingsSection: React.FC<IdentitySettingsSectionProps> = (
|
|
|
35
40
|
title: t("settings.legal.title"),
|
|
36
41
|
description: t("settings.legal.description"),
|
|
37
42
|
}}
|
|
38
|
-
|
|
43
|
+
noBackground={true}
|
|
44
|
+
hideMargin={true}
|
|
39
45
|
/>
|
|
40
46
|
)}
|
|
41
|
-
|
|
47
|
+
</SettingsSection>
|
|
42
48
|
);
|
|
43
49
|
};
|
|
50
|
+
|
|
51
|
+
|
|
@@ -28,7 +28,15 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
|
|
|
28
28
|
{(features.feedback || features.rating) && (
|
|
29
29
|
<SupportSection
|
|
30
30
|
renderSection={(props: any) => <>{props.children}</>}
|
|
31
|
-
renderItem={(props: any) =>
|
|
31
|
+
renderItem={(props: any) => (
|
|
32
|
+
<SettingsItemCard
|
|
33
|
+
title={props.title}
|
|
34
|
+
icon={props.icon}
|
|
35
|
+
onPress={props.onPress}
|
|
36
|
+
noBackground={true}
|
|
37
|
+
hideMargin={true}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
32
40
|
feedbackConfig={{
|
|
33
41
|
enabled: features.feedback,
|
|
34
42
|
config: {
|
|
@@ -78,8 +86,11 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
|
|
|
78
86
|
description={normalizedConfig.faqs.config?.description || t("settings.faqs.description")}
|
|
79
87
|
icon="help-circle-outline"
|
|
80
88
|
onPress={handleFAQPress}
|
|
89
|
+
noBackground={true}
|
|
90
|
+
hideMargin={true}
|
|
81
91
|
/>
|
|
82
92
|
)}
|
|
83
93
|
</SettingsSection>
|
|
84
94
|
);
|
|
85
95
|
};
|
|
96
|
+
|