@momo-kits/foundation 0.92.24 → 0.92.25
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 +11 -4
- package/Layout/ItemList.tsx +3 -2
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import {
|
|
3
9
|
Animated,
|
|
4
10
|
Dimensions,
|
|
@@ -19,6 +25,7 @@ import {Icon} from '../Icon';
|
|
|
19
25
|
|
|
20
26
|
const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
21
27
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
28
|
+
const [show, setShow] = useState(true);
|
|
22
29
|
const heightDevice = Dimensions.get('screen').height;
|
|
23
30
|
const insets = useSafeAreaInsets();
|
|
24
31
|
const {
|
|
@@ -77,6 +84,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
77
84
|
duration: 150,
|
|
78
85
|
}).start();
|
|
79
86
|
return () => {
|
|
87
|
+
setShow(false);
|
|
80
88
|
props.route.params?.onDismiss?.();
|
|
81
89
|
};
|
|
82
90
|
}, []);
|
|
@@ -91,11 +99,10 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
91
99
|
setTimeout(() => {
|
|
92
100
|
callback?.();
|
|
93
101
|
}, 350);
|
|
94
|
-
|
|
95
102
|
Animated.timing(pan, {
|
|
96
103
|
toValue: {x: 0, y: heightDevice},
|
|
97
104
|
useNativeDriver: false,
|
|
98
|
-
duration:
|
|
105
|
+
duration: 150,
|
|
99
106
|
}).start(() => {
|
|
100
107
|
navigator?.pop();
|
|
101
108
|
});
|
|
@@ -149,7 +156,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
149
156
|
}, []);
|
|
150
157
|
|
|
151
158
|
return (
|
|
152
|
-
<Modal transparent visible={
|
|
159
|
+
<Modal transparent visible={show} onRequestClose={() => onDismiss()}>
|
|
153
160
|
<KeyboardAvoidingView
|
|
154
161
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
155
162
|
keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -20,7 +20,7 @@ const ItemList = forwardRef(
|
|
|
20
20
|
contentContainerStyle,
|
|
21
21
|
...props
|
|
22
22
|
}: ItemListProps,
|
|
23
|
-
ref
|
|
23
|
+
ref
|
|
24
24
|
) => {
|
|
25
25
|
const {gutterSize, numberOfColumns} = useContext(GridContext);
|
|
26
26
|
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
@@ -41,6 +41,7 @@ const ItemList = forwardRef(
|
|
|
41
41
|
<FlatList
|
|
42
42
|
ref={ref as React.RefObject<FlatList>}
|
|
43
43
|
{...props}
|
|
44
|
+
key={`ItemList-${numColumns}`}
|
|
44
45
|
numColumns={numColumns}
|
|
45
46
|
renderItem={_renderItem}
|
|
46
47
|
horizontal={false}
|
|
@@ -49,7 +50,7 @@ const ItemList = forwardRef(
|
|
|
49
50
|
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
50
51
|
/>
|
|
51
52
|
);
|
|
52
|
-
}
|
|
53
|
+
}
|
|
53
54
|
);
|
|
54
55
|
|
|
55
56
|
export default ItemList;
|