@umituz/react-native-settings 1.10.0 → 1.10.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
CHANGED
|
@@ -131,8 +131,9 @@ const styles = StyleSheet.create({
|
|
|
131
131
|
flexDirection: "row",
|
|
132
132
|
alignItems: "center",
|
|
133
133
|
justifyContent: "space-between",
|
|
134
|
-
paddingHorizontal:
|
|
135
|
-
paddingVertical:
|
|
134
|
+
paddingHorizontal: 20,
|
|
135
|
+
paddingVertical: 18,
|
|
136
|
+
minHeight: 64,
|
|
136
137
|
},
|
|
137
138
|
content: {
|
|
138
139
|
flexDirection: "row",
|
|
@@ -140,12 +141,12 @@ const styles = StyleSheet.create({
|
|
|
140
141
|
flex: 1,
|
|
141
142
|
},
|
|
142
143
|
iconContainer: {
|
|
143
|
-
width:
|
|
144
|
-
height:
|
|
145
|
-
borderRadius:
|
|
144
|
+
width: 44,
|
|
145
|
+
height: 44,
|
|
146
|
+
borderRadius: 12,
|
|
146
147
|
justifyContent: "center",
|
|
147
148
|
alignItems: "center",
|
|
148
|
-
marginRight:
|
|
149
|
+
marginRight: 16,
|
|
149
150
|
},
|
|
150
151
|
textContainer: {
|
|
151
152
|
flex: 1,
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { View, ScrollView, StatusBar, StyleSheet } from "react-native";
|
|
7
|
+
import { View, ScrollView, StatusBar, StyleSheet, TouchableOpacity } from "react-native";
|
|
8
8
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
9
9
|
import { useNavigation } from "@react-navigation/native";
|
|
10
10
|
import {
|
|
11
11
|
useDesignSystemTheme,
|
|
12
12
|
useAppDesignTokens,
|
|
13
13
|
} from "@umituz/react-native-design-system-theme";
|
|
14
|
+
import { AtomicIcon } from "@umituz/react-native-design-system-atoms";
|
|
14
15
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
15
16
|
import { SettingsFooter } from "../components/SettingsFooter";
|
|
16
17
|
import { UserProfileHeader } from "../components/UserProfileHeader";
|
|
@@ -41,6 +42,10 @@ export interface SettingsScreenProps {
|
|
|
41
42
|
footerText?: string;
|
|
42
43
|
/** Custom sections to render */
|
|
43
44
|
customSections?: CustomSettingsSection[];
|
|
45
|
+
/** Show close button in header */
|
|
46
|
+
showCloseButton?: boolean;
|
|
47
|
+
/** Custom close handler */
|
|
48
|
+
onClose?: () => void;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
@@ -50,6 +55,8 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
50
55
|
showFooter = true,
|
|
51
56
|
footerText,
|
|
52
57
|
customSections = [],
|
|
58
|
+
showCloseButton = false,
|
|
59
|
+
onClose,
|
|
53
60
|
}) => {
|
|
54
61
|
const navigation = useNavigation();
|
|
55
62
|
const { themeMode } = useDesignSystemTheme();
|
|
@@ -71,16 +78,49 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
71
78
|
features.legal ||
|
|
72
79
|
customSections.length > 0;
|
|
73
80
|
|
|
81
|
+
const handleClose = () => {
|
|
82
|
+
if (onClose) {
|
|
83
|
+
onClose();
|
|
84
|
+
} else {
|
|
85
|
+
navigation.goBack();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
74
89
|
return (
|
|
75
90
|
<View style={[styles.container, { backgroundColor: colors.backgroundPrimary }]}>
|
|
76
91
|
<StatusBar barStyle={isDark ? "light-content" : "dark-content"} />
|
|
77
92
|
|
|
93
|
+
{showCloseButton && (
|
|
94
|
+
<View
|
|
95
|
+
style={[
|
|
96
|
+
styles.closeButtonContainer,
|
|
97
|
+
{
|
|
98
|
+
paddingTop: insets.top + spacing.xs,
|
|
99
|
+
paddingRight: spacing.md,
|
|
100
|
+
},
|
|
101
|
+
]}
|
|
102
|
+
>
|
|
103
|
+
<TouchableOpacity
|
|
104
|
+
onPress={handleClose}
|
|
105
|
+
style={[
|
|
106
|
+
styles.closeButton,
|
|
107
|
+
{
|
|
108
|
+
backgroundColor: colors.surface,
|
|
109
|
+
},
|
|
110
|
+
]}
|
|
111
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
112
|
+
>
|
|
113
|
+
<AtomicIcon name="X" size="lg" color="primary" />
|
|
114
|
+
</TouchableOpacity>
|
|
115
|
+
</View>
|
|
116
|
+
)}
|
|
117
|
+
|
|
78
118
|
<ScrollView
|
|
79
119
|
style={styles.scrollView}
|
|
80
120
|
contentContainerStyle={[
|
|
81
121
|
styles.scrollContent,
|
|
82
122
|
{
|
|
83
|
-
paddingTop: insets.top + spacing.md,
|
|
123
|
+
paddingTop: showCloseButton ? spacing.md : insets.top + spacing.md,
|
|
84
124
|
paddingBottom: spacing.xxxl + spacing.xl,
|
|
85
125
|
paddingHorizontal: 0,
|
|
86
126
|
},
|
|
@@ -152,6 +192,20 @@ const styles = StyleSheet.create({
|
|
|
152
192
|
container: {
|
|
153
193
|
flex: 1,
|
|
154
194
|
},
|
|
195
|
+
closeButtonContainer: {
|
|
196
|
+
position: "absolute",
|
|
197
|
+
top: 0,
|
|
198
|
+
right: 0,
|
|
199
|
+
zIndex: 10,
|
|
200
|
+
alignItems: "flex-end",
|
|
201
|
+
},
|
|
202
|
+
closeButton: {
|
|
203
|
+
width: 44,
|
|
204
|
+
height: 44,
|
|
205
|
+
borderRadius: 22,
|
|
206
|
+
justifyContent: "center",
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
},
|
|
155
209
|
scrollView: {
|
|
156
210
|
flex: 1,
|
|
157
211
|
},
|