@hoddy-ui/core 2.5.6 → 2.5.8
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/next/dist/index.js +43 -29
- package/next/dist/index.js.map +1 -1
- package/next/dist/index.mjs +59 -45
- package/next/dist/index.mjs.map +1 -1
- package/next/package.json +1 -1
- package/package.json +1 -1
- package/src/Components/Popup.tsx +32 -22
- package/src/Components/TextField.tsx +1 -1
package/next/package.json
CHANGED
package/package.json
CHANGED
package/src/Components/Popup.tsx
CHANGED
|
@@ -17,18 +17,19 @@ import Animated, {
|
|
|
17
17
|
useSharedValue,
|
|
18
18
|
withTiming,
|
|
19
19
|
} from "react-native-reanimated";
|
|
20
|
-
import { ScaledSheet } from "react-native-size-matters";
|
|
20
|
+
import { ms, ScaledSheet } from "react-native-size-matters";
|
|
21
21
|
import { useColors, useTheme } from "../hooks";
|
|
22
22
|
import { UIThemeProvider } from "../theme";
|
|
23
23
|
import { PopupProps } from "../types";
|
|
24
24
|
import { IconButton } from "./Button";
|
|
25
25
|
import Typography from "./Typography";
|
|
26
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
26
27
|
|
|
27
28
|
export const Popup: React.FC<PopupProps> = ({
|
|
28
29
|
title,
|
|
29
30
|
sheet,
|
|
30
31
|
bare = false,
|
|
31
|
-
keyboardVerticalOffset,
|
|
32
|
+
keyboardVerticalOffset = -10,
|
|
32
33
|
children,
|
|
33
34
|
open,
|
|
34
35
|
onClose = () => {},
|
|
@@ -39,6 +40,7 @@ export const Popup: React.FC<PopupProps> = ({
|
|
|
39
40
|
const theme = useTheme();
|
|
40
41
|
const colors = useColors();
|
|
41
42
|
const [modalVisible, setModalVisible] = useState(false);
|
|
43
|
+
const { bottom } = useSafeAreaInsets();
|
|
42
44
|
|
|
43
45
|
// Animation values
|
|
44
46
|
const backdropOpacity = useSharedValue(0);
|
|
@@ -82,22 +84,26 @@ export const Popup: React.FC<PopupProps> = ({
|
|
|
82
84
|
width: "100%",
|
|
83
85
|
justifyContent: sheet ? "flex-end" : "center",
|
|
84
86
|
},
|
|
87
|
+
keyboardView: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
85
90
|
avoidingView: {
|
|
86
91
|
minHeight: typeof sheet === "number" ? sheet : undefined,
|
|
87
|
-
maxHeight: "
|
|
92
|
+
maxHeight: "90%",
|
|
88
93
|
zIndex: 1000,
|
|
89
94
|
alignSelf: "center",
|
|
90
95
|
maxWidth: sheet ? undefined : "90%",
|
|
91
96
|
width: sheet ? "100%" : undefined,
|
|
92
97
|
},
|
|
93
98
|
container: {
|
|
94
|
-
paddingBottom: sheet ?
|
|
95
|
-
backgroundColor: theme === "dark" ? "#111" : colors.white[
|
|
99
|
+
paddingBottom: sheet && !bare ? bottom + ms(10) : undefined,
|
|
100
|
+
backgroundColor: theme === "dark" ? "#111" : colors.white[1],
|
|
96
101
|
borderTopLeftRadius: 20,
|
|
97
102
|
borderTopRightRadius: 20,
|
|
98
103
|
borderBottomRightRadius: sheet ? 0 : 20,
|
|
99
104
|
borderBottomLeftRadius: sheet ? 0 : 20,
|
|
100
105
|
width: "100%",
|
|
106
|
+
overflow: "hidden",
|
|
101
107
|
...style,
|
|
102
108
|
},
|
|
103
109
|
content: {
|
|
@@ -135,20 +141,24 @@ export const Popup: React.FC<PopupProps> = ({
|
|
|
135
141
|
onRequestClose={closeAction}
|
|
136
142
|
>
|
|
137
143
|
<UIThemeProvider>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
/>
|
|
146
|
-
|
|
144
|
+
<KeyboardAvoidingView
|
|
145
|
+
style={styles.keyboardView}
|
|
146
|
+
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
|
147
|
+
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
148
|
+
>
|
|
149
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
150
|
+
<View style={styles.root}>
|
|
151
|
+
<Animated.View style={[styles.backdrop, backdropAnimatedStyle]} />
|
|
152
|
+
{open && (
|
|
153
|
+
<Pressable
|
|
154
|
+
style={[StyleSheet.absoluteFill, { zIndex: 2 }]}
|
|
155
|
+
onPress={closeAction}
|
|
156
|
+
/>
|
|
157
|
+
)}
|
|
147
158
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
behavior={Platform.OS === "ios" ? "padding" : "padding"}
|
|
159
|
+
<Animated.View
|
|
160
|
+
style={[styles.avoidingView, contentAnimatedStyle]}
|
|
161
|
+
layout={LinearTransition}
|
|
152
162
|
>
|
|
153
163
|
<Animated.View
|
|
154
164
|
layout={LinearTransition}
|
|
@@ -171,10 +181,10 @@ export const Popup: React.FC<PopupProps> = ({
|
|
|
171
181
|
|
|
172
182
|
<View style={styles.content}>{children}</View>
|
|
173
183
|
</Animated.View>
|
|
174
|
-
</
|
|
175
|
-
</
|
|
176
|
-
</
|
|
177
|
-
</
|
|
184
|
+
</Animated.View>
|
|
185
|
+
</View>
|
|
186
|
+
</TouchableWithoutFeedback>
|
|
187
|
+
</KeyboardAvoidingView>
|
|
178
188
|
</UIThemeProvider>
|
|
179
189
|
</Modal>
|
|
180
190
|
);
|