@momo-kits/foundation 0.92.26-beta.6 → 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.
@@ -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: 200,
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
- }, 300);
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
  /**
@@ -161,7 +165,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
161
165
  <Animated.View style={{transform: pan.getTranslateTransform()}}>
162
166
  {renderHeader()}
163
167
  <View style={{backgroundColor: backgroundColor}}>
164
- <Screen {...props} {...props.route.params} />
168
+ <Screen
169
+ {...props}
170
+ {...props.route.params}
171
+ requestClose={requestClose}
172
+ />
165
173
  {useBottomInset && (
166
174
  <View style={{height: Math.min(insets.bottom, 21)}} />
167
175
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.26-beta.6",
3
+ "version": "0.92.26",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},