@umituz/react-native-settings 4.19.0 → 4.19.2
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 +2 -2
- package/src/domains/appearance/presentation/components/AppearanceSection.tsx +10 -96
- package/src/index.ts +3 -0
- package/src/presentation/components/SettingsItemCard.tsx +139 -0
- package/src/presentation/screens/components/SettingsContent.tsx +2 -2
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +15 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.2",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, and rating",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
"@react-native-firebase/firestore": "^23.7.0",
|
|
89
89
|
"firebase": "^12.7.0"
|
|
90
90
|
}
|
|
91
|
-
}
|
|
91
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
|
-
import { useResponsiveDesignTokens, AtomicIcon, AtomicText } from '@umituz/react-native-design-system';
|
|
5
4
|
import { AppearanceSectionConfig } from '../../types';
|
|
5
|
+
import { SettingsItemCard } from '../../../../presentation/components/SettingsItemCard';
|
|
6
6
|
|
|
7
7
|
export interface AppearanceSectionProps {
|
|
8
8
|
config?: AppearanceSectionConfig;
|
|
@@ -24,17 +24,11 @@ export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
|
24
24
|
description: descriptionProp,
|
|
25
25
|
}) => {
|
|
26
26
|
const navigation = useNavigation();
|
|
27
|
-
const tokens = useResponsiveDesignTokens();
|
|
28
|
-
const colors = tokens.colors;
|
|
29
27
|
|
|
30
28
|
const route = config?.route || config?.defaultRoute || 'Appearance';
|
|
31
|
-
// Use props first, then config, then strict empty string to avoid hardcoded English
|
|
32
29
|
const title = titleProp || config?.title;
|
|
33
30
|
const description = descriptionProp || config?.description;
|
|
34
31
|
|
|
35
|
-
// Only display section title if provided
|
|
36
|
-
const displaySectionTitle = sectionTitle || title;
|
|
37
|
-
|
|
38
32
|
const handlePress = () => {
|
|
39
33
|
if (onPress) {
|
|
40
34
|
onPress();
|
|
@@ -46,94 +40,14 @@ export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
|
46
40
|
if (!title) return null;
|
|
47
41
|
|
|
48
42
|
return (
|
|
49
|
-
<
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</AtomicText>
|
|
58
|
-
</View>
|
|
59
|
-
)}
|
|
60
|
-
<Pressable
|
|
61
|
-
style={({ pressed }) => [
|
|
62
|
-
styles.itemContainer,
|
|
63
|
-
{
|
|
64
|
-
backgroundColor: pressed ? `${colors.primary}08` : 'transparent',
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
onPress={handlePress}
|
|
68
|
-
>
|
|
69
|
-
<View style={styles.content}>
|
|
70
|
-
<View
|
|
71
|
-
style={[
|
|
72
|
-
styles.iconContainer,
|
|
73
|
-
{ backgroundColor: `${colors.primary}15` },
|
|
74
|
-
]}
|
|
75
|
-
>
|
|
76
|
-
<AtomicIcon name="color-palette" size="lg" color="primary" />
|
|
77
|
-
</View>
|
|
78
|
-
<View style={styles.textContainer}>
|
|
79
|
-
<AtomicText
|
|
80
|
-
type="bodyLarge"
|
|
81
|
-
color="primary"
|
|
82
|
-
numberOfLines={1}
|
|
83
|
-
style={{ marginBottom: 4 }}
|
|
84
|
-
>
|
|
85
|
-
{title}
|
|
86
|
-
</AtomicText>
|
|
87
|
-
{!!description && (
|
|
88
|
-
<AtomicText
|
|
89
|
-
type="bodyMedium"
|
|
90
|
-
color="secondary"
|
|
91
|
-
numberOfLines={2}
|
|
92
|
-
>
|
|
93
|
-
{description}
|
|
94
|
-
</AtomicText>
|
|
95
|
-
)}
|
|
96
|
-
</View>
|
|
97
|
-
<AtomicIcon name="chevron-forward" size="md" color="secondary" />
|
|
98
|
-
</View>
|
|
99
|
-
</Pressable>
|
|
100
|
-
</View>
|
|
43
|
+
<SettingsItemCard
|
|
44
|
+
title={title}
|
|
45
|
+
description={description}
|
|
46
|
+
icon="color-palette"
|
|
47
|
+
onPress={handlePress}
|
|
48
|
+
containerStyle={containerStyle}
|
|
49
|
+
sectionTitle={sectionTitle}
|
|
50
|
+
/>
|
|
101
51
|
);
|
|
102
52
|
};
|
|
103
53
|
|
|
104
|
-
const styles = StyleSheet.create({
|
|
105
|
-
sectionContainer: {
|
|
106
|
-
marginBottom: 16,
|
|
107
|
-
borderRadius: 12,
|
|
108
|
-
overflow: 'hidden',
|
|
109
|
-
},
|
|
110
|
-
headerContainer: {
|
|
111
|
-
paddingHorizontal: 16,
|
|
112
|
-
paddingTop: 16,
|
|
113
|
-
paddingBottom: 8,
|
|
114
|
-
},
|
|
115
|
-
itemContainer: {
|
|
116
|
-
flexDirection: 'row',
|
|
117
|
-
alignItems: 'center',
|
|
118
|
-
paddingHorizontal: 16,
|
|
119
|
-
paddingVertical: 16,
|
|
120
|
-
minHeight: 72,
|
|
121
|
-
},
|
|
122
|
-
content: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
flexDirection: 'row',
|
|
125
|
-
alignItems: 'center',
|
|
126
|
-
},
|
|
127
|
-
iconContainer: {
|
|
128
|
-
width: 48,
|
|
129
|
-
height: 48,
|
|
130
|
-
borderRadius: 12,
|
|
131
|
-
justifyContent: 'center',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
marginRight: 16,
|
|
134
|
-
},
|
|
135
|
-
textContainer: {
|
|
136
|
-
flex: 1,
|
|
137
|
-
marginRight: 8,
|
|
138
|
-
},
|
|
139
|
-
});
|
package/src/index.ts
CHANGED
|
@@ -72,6 +72,9 @@ export type {
|
|
|
72
72
|
export { SettingItem } from './presentation/components/SettingItem';
|
|
73
73
|
export type { SettingItemProps } from './presentation/components/SettingItem';
|
|
74
74
|
|
|
75
|
+
export { SettingsItemCard } from './presentation/components/SettingsItemCard';
|
|
76
|
+
export type { SettingsItemCardProps } from './presentation/components/SettingsItemCard';
|
|
77
|
+
|
|
75
78
|
export { SettingsSection } from './presentation/components/SettingsSection';
|
|
76
79
|
export type { SettingsSectionProps } from './presentation/components/SettingsSection';
|
|
77
80
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Pressable, StyleSheet, ViewStyle } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
useResponsiveDesignTokens,
|
|
5
|
+
AtomicIcon,
|
|
6
|
+
AtomicText,
|
|
7
|
+
type IconName,
|
|
8
|
+
} from "@umituz/react-native-design-system";
|
|
9
|
+
|
|
10
|
+
export interface SettingsItemCardProps {
|
|
11
|
+
/** Item title */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Optional description or current value */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Icon name from AtomicIcon */
|
|
16
|
+
icon: IconName;
|
|
17
|
+
/** On press handler */
|
|
18
|
+
onPress: () => void;
|
|
19
|
+
/** Optional container style */
|
|
20
|
+
containerStyle?: ViewStyle;
|
|
21
|
+
/** Optional section title (shows above the card) */
|
|
22
|
+
sectionTitle?: string;
|
|
23
|
+
/** Optional right icon (defaults to chevron-forward) */
|
|
24
|
+
rightIcon?: IconName;
|
|
25
|
+
/** Optional icon background color (defaults to primary with opacity) */
|
|
26
|
+
iconBgColor?: string;
|
|
27
|
+
/** Optional icon color */
|
|
28
|
+
iconColor?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* SettingsItemCard
|
|
33
|
+
*
|
|
34
|
+
* A premium, consistent card for settings items used across all apps.
|
|
35
|
+
* Follows the visual style of the Appearance section.
|
|
36
|
+
*/
|
|
37
|
+
export const SettingsItemCard: React.FC<SettingsItemCardProps> = ({
|
|
38
|
+
title,
|
|
39
|
+
description,
|
|
40
|
+
icon,
|
|
41
|
+
onPress,
|
|
42
|
+
containerStyle,
|
|
43
|
+
sectionTitle,
|
|
44
|
+
rightIcon = "chevron-forward",
|
|
45
|
+
iconBgColor,
|
|
46
|
+
iconColor,
|
|
47
|
+
}) => {
|
|
48
|
+
const tokens = useResponsiveDesignTokens();
|
|
49
|
+
const colors = tokens.colors;
|
|
50
|
+
|
|
51
|
+
const defaultIconBg = iconBgColor || `${colors.primary}15`;
|
|
52
|
+
const defaultIconColor = iconColor || colors.primary;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.sectionContainer,
|
|
58
|
+
{ backgroundColor: colors.surface },
|
|
59
|
+
containerStyle,
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
{!!sectionTitle && (
|
|
63
|
+
<View style={styles.headerContainer}>
|
|
64
|
+
<AtomicText type="titleMedium" color="primary">
|
|
65
|
+
{sectionTitle}
|
|
66
|
+
</AtomicText>
|
|
67
|
+
</View>
|
|
68
|
+
)}
|
|
69
|
+
<Pressable
|
|
70
|
+
style={({ pressed }) => [
|
|
71
|
+
styles.itemContainer,
|
|
72
|
+
{
|
|
73
|
+
backgroundColor: pressed ? `${colors.primary}08` : "transparent",
|
|
74
|
+
},
|
|
75
|
+
]}
|
|
76
|
+
onPress={onPress}
|
|
77
|
+
>
|
|
78
|
+
<View style={styles.content}>
|
|
79
|
+
<View style={[styles.iconContainer, { backgroundColor: defaultIconBg }]}>
|
|
80
|
+
<AtomicIcon name={icon} size="lg" customColor={defaultIconColor} />
|
|
81
|
+
</View>
|
|
82
|
+
<View style={styles.textContainer}>
|
|
83
|
+
<AtomicText
|
|
84
|
+
type="bodyLarge"
|
|
85
|
+
color="onSurface"
|
|
86
|
+
numberOfLines={1}
|
|
87
|
+
style={{ marginBottom: 4 }}
|
|
88
|
+
>
|
|
89
|
+
{title}
|
|
90
|
+
</AtomicText>
|
|
91
|
+
{!!description && (
|
|
92
|
+
<AtomicText type="bodyMedium" color="secondary" numberOfLines={2}>
|
|
93
|
+
{description}
|
|
94
|
+
</AtomicText>
|
|
95
|
+
)}
|
|
96
|
+
</View>
|
|
97
|
+
<AtomicIcon name={rightIcon} size="sm" color="secondary" />
|
|
98
|
+
</View>
|
|
99
|
+
</Pressable>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const styles = StyleSheet.create({
|
|
105
|
+
sectionContainer: {
|
|
106
|
+
marginBottom: 16,
|
|
107
|
+
borderRadius: 12,
|
|
108
|
+
overflow: "hidden",
|
|
109
|
+
},
|
|
110
|
+
headerContainer: {
|
|
111
|
+
paddingHorizontal: 16,
|
|
112
|
+
paddingTop: 16,
|
|
113
|
+
paddingBottom: 8,
|
|
114
|
+
},
|
|
115
|
+
itemContainer: {
|
|
116
|
+
flexDirection: "row",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
paddingHorizontal: 16,
|
|
119
|
+
paddingVertical: 16,
|
|
120
|
+
minHeight: 72,
|
|
121
|
+
},
|
|
122
|
+
content: {
|
|
123
|
+
flex: 1,
|
|
124
|
+
flexDirection: "row",
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
},
|
|
127
|
+
iconContainer: {
|
|
128
|
+
width: 48,
|
|
129
|
+
height: 48,
|
|
130
|
+
borderRadius: 12,
|
|
131
|
+
justifyContent: "center",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
marginRight: 16,
|
|
134
|
+
},
|
|
135
|
+
textContainer: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
marginRight: 8,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
@@ -86,6 +86,8 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
86
86
|
>
|
|
87
87
|
{showUserProfile && <ProfileSectionLoader userProfile={userProfile} />}
|
|
88
88
|
|
|
89
|
+
<CustomSettingsList customSections={customSections} />
|
|
90
|
+
|
|
89
91
|
<FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
90
92
|
|
|
91
93
|
<IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
@@ -94,8 +96,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
94
96
|
|
|
95
97
|
{features.disclaimer && <DisclaimerSetting />}
|
|
96
98
|
|
|
97
|
-
<CustomSettingsList customSections={customSections} />
|
|
98
|
-
|
|
99
99
|
{!hasAnyFeatures && (
|
|
100
100
|
<View style={styles.emptyContainer}>
|
|
101
101
|
<SettingsSection title={config?.emptyStateText || t("settings.noOptionsAvailable")}>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { useNavigation } from "@react-navigation/native";
|
|
2
3
|
import { AppearanceSection } from "../../../../domains/appearance/presentation/components/AppearanceSection";
|
|
3
|
-
import { LanguageSection } from "@umituz/react-native-localization";
|
|
4
4
|
import { NotificationsSection } from "@umituz/react-native-notifications";
|
|
5
5
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
6
|
+
import { SettingsItemCard } from "../../../components/SettingsItemCard";
|
|
6
7
|
import type { NormalizedConfig } from "../../utils/normalizeConfig";
|
|
7
8
|
|
|
8
9
|
interface FeatureSettingsSectionProps {
|
|
@@ -18,7 +19,13 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
18
19
|
normalizedConfig,
|
|
19
20
|
features,
|
|
20
21
|
}) => {
|
|
21
|
-
const { t } = useLocalization();
|
|
22
|
+
const { t, currentLanguage } = useLocalization();
|
|
23
|
+
const navigation = useNavigation();
|
|
24
|
+
|
|
25
|
+
const handleLanguagePress = () => {
|
|
26
|
+
const route = normalizedConfig.language.config?.route || "LanguageSelection";
|
|
27
|
+
navigation.navigate(route as never);
|
|
28
|
+
};
|
|
22
29
|
|
|
23
30
|
return (
|
|
24
31
|
<>
|
|
@@ -34,14 +41,12 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
34
41
|
)}
|
|
35
42
|
|
|
36
43
|
{features.language && (
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
t("settings.languageSelection.description"),
|
|
44
|
-
}}
|
|
44
|
+
<SettingsItemCard
|
|
45
|
+
title={t("settings.languageSelection.title")}
|
|
46
|
+
description={currentLanguage || "English"}
|
|
47
|
+
icon="globe-outline"
|
|
48
|
+
onPress={handleLanguagePress}
|
|
49
|
+
sectionTitle={t("settings.languageSelection.title")}
|
|
45
50
|
/>
|
|
46
51
|
)}
|
|
47
52
|
|