@momo-kits/foundation 0.92.26-beta.7 → 0.92.26-beta.8

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.
@@ -8,6 +8,7 @@ import {
8
8
  StyleSheet,
9
9
  TouchableOpacity,
10
10
  View,
11
+ Modal,
11
12
  } from 'react-native';
12
13
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
13
14
  import {ApplicationContext} from './index';
@@ -23,6 +24,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
23
24
  const {
24
25
  screen: Screen,
25
26
  options,
27
+ useNativeModal = false,
26
28
  surface,
27
29
  barrierDismissible = false,
28
30
  draggable = true,
@@ -61,17 +63,23 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
61
63
  },
62
64
  })
63
65
  ).current;
64
-
66
+ let Container: any = View;
67
+ if (useNativeModal) {
68
+ Container = Modal;
69
+ }
65
70
  let backgroundColor = theme.colors.background.default;
66
71
  if (surface) {
67
72
  backgroundColor = theme.colors.background.surface;
68
73
  }
69
74
 
75
+ /**
76
+ * emit dismiss event
77
+ */
70
78
  useEffect(() => {
71
79
  Animated.timing(pan, {
72
80
  toValue: {x: 0, y: 0},
73
81
  useNativeDriver: false,
74
- duration: 50,
82
+ duration: 150,
75
83
  }).start();
76
84
  return () => {
77
85
  props.route.params?.onDismiss?.();
@@ -79,9 +87,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
79
87
  }, []);
80
88
 
81
89
  /**
82
- * on dismiss
83
- * @param force
84
- * @param callback
90
+ * handler dismiss
85
91
  */
86
92
  const onDismiss = (force = false, callback?: () => void) => {
87
93
  if (barrierDismissible && !force) {
@@ -106,6 +112,9 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
106
112
  onDismiss(true, callback);
107
113
  }, []);
108
114
 
115
+ /**
116
+ * render header
117
+ */
109
118
  const renderHeader = useCallback(() => {
110
119
  return (
111
120
  <View
@@ -144,7 +153,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
144
153
  }, []);
145
154
 
146
155
  return (
147
- <View style={styles.overlay}>
156
+ <Container
157
+ transparent
158
+ visible={true}
159
+ onRequestClose={() => onDismiss()}
160
+ style={styles.overlay}>
148
161
  <KeyboardAvoidingView
149
162
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
150
163
  keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
@@ -168,7 +181,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
168
181
  </View>
169
182
  </Animated.View>
170
183
  </KeyboardAvoidingView>
171
- </View>
184
+ </Container>
172
185
  );
173
186
  };
174
187
 
@@ -115,6 +115,7 @@ export type BottomSheetParams = {
115
115
  title: string;
116
116
  surface?: boolean;
117
117
  };
118
+ useNativeModal?: boolean;
118
119
  surface?: boolean;
119
120
  onDismiss?: (type?: string) => void;
120
121
  barrierDismissible?: boolean;
@@ -5,7 +5,7 @@ import {Button} from '../Button';
5
5
  import {Radius, Spacing, Styles} from '../Consts';
6
6
  import {Icon} from '../Icon';
7
7
  import {Image} from '../Image';
8
- import {Text} from '../Text';
8
+ import {scaleSize, Text} from '../Text';
9
9
  import {PopupNotifyProps} from './types';
10
10
 
11
11
  const PopupNotify: React.FC<PopupNotifyProps> = ({
@@ -27,7 +27,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
27
27
  let Description: any = View;
28
28
  if (scrollContent) {
29
29
  Description = ScrollView;
30
- descriptionStyle = {height: 80};
30
+ descriptionStyle = {maxHeight: scaleSize(164)};
31
31
  }
32
32
  /**
33
33
  * tracking
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.26-beta.7",
3
+ "version": "0.92.26-beta.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},