@momo-kits/foundation 0.92.25 → 0.92.26-beta.1
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/Application/BottomSheet.tsx +10 -14
- package/package.json +1 -1
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useCallback,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import React, {useCallback, useContext, useEffect, useRef} from 'react';
|
|
8
2
|
import {
|
|
9
3
|
Animated,
|
|
10
4
|
Dimensions,
|
|
@@ -25,7 +19,6 @@ import {Icon} from '../Icon';
|
|
|
25
19
|
|
|
26
20
|
const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
27
21
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
28
|
-
const [show, setShow] = useState(true);
|
|
29
22
|
const heightDevice = Dimensions.get('screen').height;
|
|
30
23
|
const insets = useSafeAreaInsets();
|
|
31
24
|
const {
|
|
@@ -81,10 +74,9 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
81
74
|
Animated.timing(pan, {
|
|
82
75
|
toValue: {x: 0, y: 0},
|
|
83
76
|
useNativeDriver: false,
|
|
84
|
-
duration:
|
|
77
|
+
duration: 200,
|
|
85
78
|
}).start();
|
|
86
79
|
return () => {
|
|
87
|
-
setShow(false);
|
|
88
80
|
props.route.params?.onDismiss?.();
|
|
89
81
|
};
|
|
90
82
|
}, []);
|
|
@@ -98,11 +90,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
98
90
|
}
|
|
99
91
|
setTimeout(() => {
|
|
100
92
|
callback?.();
|
|
101
|
-
},
|
|
93
|
+
}, 300);
|
|
102
94
|
Animated.timing(pan, {
|
|
103
95
|
toValue: {x: 0, y: heightDevice},
|
|
104
96
|
useNativeDriver: false,
|
|
105
|
-
duration:
|
|
97
|
+
duration: 200,
|
|
106
98
|
}).start(() => {
|
|
107
99
|
navigator?.pop();
|
|
108
100
|
});
|
|
@@ -156,7 +148,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
156
148
|
}, []);
|
|
157
149
|
|
|
158
150
|
return (
|
|
159
|
-
<Modal transparent visible={
|
|
151
|
+
<Modal transparent visible={true} onRequestClose={() => onDismiss()}>
|
|
160
152
|
<KeyboardAvoidingView
|
|
161
153
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
162
154
|
keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
|
|
@@ -172,7 +164,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
172
164
|
<Screen
|
|
173
165
|
{...props}
|
|
174
166
|
{...props.route.params}
|
|
175
|
-
requestClose={
|
|
167
|
+
requestClose={
|
|
168
|
+
props.requestClose ??
|
|
169
|
+
props.route.params?.requestClose ??
|
|
170
|
+
requestClose
|
|
171
|
+
}
|
|
176
172
|
/>
|
|
177
173
|
{useBottomInset && (
|
|
178
174
|
<View style={{height: Math.min(insets.bottom, 21)}} />
|