@momo-kits/foundation 0.92.26-beta.2 → 0.92.26-beta.3

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.
@@ -1,18 +1,17 @@
1
- import React, {useCallback, useContext, useEffect, useRef} from 'react';
1
+ import React, {useRef, useEffect, useCallback, useContext} from 'react';
2
2
  import {
3
3
  Animated,
4
4
  Dimensions,
5
5
  KeyboardAvoidingView,
6
- Modal,
7
6
  PanResponder,
8
7
  Platform,
9
8
  StyleSheet,
10
9
  TouchableOpacity,
11
10
  View,
12
11
  } from 'react-native';
12
+ import {useSafeAreaInsets} from 'react-native-safe-area-context';
13
13
  import {ApplicationContext} from './index';
14
14
  import {BottomSheetParams} from './types';
15
- import {useSafeAreaInsets} from 'react-native-safe-area-context';
16
15
  import {Colors, Radius, Spacing, Styles} from '../Consts';
17
16
  import {Text} from '../Text';
18
17
  import {Icon} from '../Icon';
@@ -67,9 +66,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
67
66
  backgroundColor = theme.colors.background.surface;
68
67
  }
69
68
 
70
- /**
71
- * emit dismiss event
72
- */
73
69
  useEffect(() => {
74
70
  Animated.timing(pan, {
75
71
  toValue: {x: 0, y: 0},
@@ -81,9 +77,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
81
77
  };
82
78
  }, []);
83
79
 
84
- /**
85
- * handler dismiss
86
- */
87
80
  const onDismiss = (force = false, callback?: () => void) => {
88
81
  if (barrierDismissible && !force) {
89
82
  return;
@@ -100,16 +93,10 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
100
93
  });
101
94
  };
102
95
 
103
- /**
104
- * manual close
105
- */
106
96
  const requestClose = useCallback((callback?: () => void) => {
107
97
  onDismiss(true, callback);
108
98
  }, []);
109
99
 
110
- /**
111
- * render header
112
- */
113
100
  const renderHeader = useCallback(() => {
114
101
  return (
115
102
  <View
@@ -148,7 +135,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
148
135
  }, []);
149
136
 
150
137
  return (
151
- <Modal transparent visible={true} onRequestClose={() => onDismiss()}>
138
+ <View style={styles.overlay}>
152
139
  <KeyboardAvoidingView
153
140
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
154
141
  keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
@@ -164,11 +151,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
164
151
  <Screen
165
152
  {...props}
166
153
  {...props.route.params}
167
- // requestClose={
168
- // props.requestClose ??
169
- // props.route.params?.requestClose ??
170
- // requestClose
171
- // }
154
+ requestClose={requestClose}
172
155
  />
173
156
  {useBottomInset && (
174
157
  <View style={{height: Math.min(insets.bottom, 21)}} />
@@ -176,23 +159,14 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
176
159
  </View>
177
160
  </Animated.View>
178
161
  </KeyboardAvoidingView>
179
- </Modal>
162
+ </View>
180
163
  );
181
164
  };
182
165
 
183
- export default BottomSheet;
184
-
185
166
  const styles = StyleSheet.create({
186
- container: {
187
- width: '100%',
188
- height: 0,
189
- overflow: 'hidden',
190
- borderTopLeftRadius: Radius.M,
191
- borderTopRightRadius: Radius.M,
192
- },
193
- draggableContainer: {
194
- width: '100%',
195
- alignItems: 'center',
167
+ overlay: {
168
+ ...StyleSheet.absoluteFillObject,
169
+ justifyContent: 'flex-end',
196
170
  },
197
171
  indicator: {
198
172
  width: 40,
@@ -216,3 +190,5 @@ const styles = StyleSheet.create({
216
190
  marginHorizontal: Spacing.M,
217
191
  },
218
192
  });
193
+
194
+ export default BottomSheet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.26-beta.2",
3
+ "version": "0.92.26-beta.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},