@momo-kits/foundation 0.92.26-beta.5 → 0.92.26
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 -6
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ import {Icon} from '../Icon';
|
|
|
19
19
|
|
|
20
20
|
const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
21
21
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
22
|
+
const closed = useRef(false);
|
|
22
23
|
const heightDevice = Dimensions.get('screen').height;
|
|
23
24
|
const insets = useSafeAreaInsets();
|
|
24
25
|
const {
|
|
@@ -74,9 +75,12 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
74
75
|
Animated.timing(pan, {
|
|
75
76
|
toValue: {x: 0, y: 0},
|
|
76
77
|
useNativeDriver: false,
|
|
77
|
-
duration:
|
|
78
|
+
duration: 150,
|
|
78
79
|
}).start();
|
|
79
80
|
return () => {
|
|
81
|
+
if (!closed.current) {
|
|
82
|
+
navigator?.pop();
|
|
83
|
+
}
|
|
80
84
|
props.route.params?.onDismiss?.();
|
|
81
85
|
};
|
|
82
86
|
}, []);
|
|
@@ -89,15 +93,15 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
89
93
|
return;
|
|
90
94
|
}
|
|
91
95
|
setTimeout(() => {
|
|
96
|
+
closed.current = true;
|
|
97
|
+
navigator?.pop();
|
|
92
98
|
callback?.();
|
|
93
|
-
},
|
|
99
|
+
}, 350);
|
|
94
100
|
Animated.timing(pan, {
|
|
95
101
|
toValue: {x: 0, y: heightDevice},
|
|
96
102
|
useNativeDriver: false,
|
|
97
103
|
duration: 200,
|
|
98
|
-
}).start(
|
|
99
|
-
navigator?.pop();
|
|
100
|
-
});
|
|
104
|
+
}).start();
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
/**
|
|
@@ -162,9 +166,9 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
162
166
|
{renderHeader()}
|
|
163
167
|
<View style={{backgroundColor: backgroundColor}}>
|
|
164
168
|
<Screen
|
|
165
|
-
requestClose={requestClose}
|
|
166
169
|
{...props}
|
|
167
170
|
{...props.route.params}
|
|
171
|
+
requestClose={requestClose}
|
|
168
172
|
/>
|
|
169
173
|
{useBottomInset && (
|
|
170
174
|
<View style={{height: Math.min(insets.bottom, 21)}} />
|