@particle-network/ui-native 0.0.26 → 0.0.27

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,24 +1,65 @@
1
1
  import React from 'react';
2
- import { ScrollView, type StyleProp, type ViewStyle } from 'react-native';
2
+ import { ScrollView, type ScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
3
3
  export interface UXModalProps {
4
4
  modalName?: string;
5
+ /**
6
+ * 容器样式
7
+ */
5
8
  style?: StyleProp<ViewStyle>;
9
+ /**
10
+ * 内容样式
11
+ */
6
12
  contentStyle?: StyleProp<ViewStyle>;
7
13
  isOpen: boolean;
14
+ /**
15
+ * 标题
16
+ */
8
17
  title?: React.ReactNode;
18
+ /**
19
+ * 顶部内容,可以固定位置,如搜索框
20
+ */
21
+ topContent?: React.ReactNode;
22
+ /**
23
+ * 标题对齐方式
24
+ */
9
25
  titleAlign?: 'left' | 'center';
26
+ /**
27
+ * 底部内容
28
+ */
10
29
  footer?: React.ReactNode;
30
+ /**
31
+ * 提示内容
32
+ */
11
33
  tip?: React.ReactNode;
34
+ /**
35
+ * 关闭回调
36
+ */
12
37
  onClose?: () => void;
38
+ /**
39
+ * 可见性变化回调
40
+ */
13
41
  onVisibleChange?: (visible: boolean) => void;
14
42
  children: React.ReactNode;
43
+ /**
44
+ * 是否禁用滑动关闭弹窗
45
+ */
15
46
  disableCloseBySwipe?: boolean;
47
+ /**
48
+ * 是否只允许通过点击指示线关闭弹窗
49
+ */
16
50
  closeByLineOnly?: boolean;
51
+ /**
52
+ * 是否需要包裹 portal
53
+ */
17
54
  wrapPortal?: boolean;
18
55
  /**
19
56
  * 键盘避开区域
20
57
  * 如果想要遮挡 footer 则选择 content
21
58
  */
22
59
  keyboardAvoidPosition?: 'container' | 'content';
60
+ /**
61
+ * ScrollView 属性
62
+ */
63
+ scrollViewProps?: ScrollViewProps;
23
64
  }
24
65
  export declare const UXModal: React.ForwardRefExoticComponent<UXModalProps & React.RefAttributes<ScrollView>>;
@@ -13,7 +13,8 @@ import { VStack } from "../layout/VStack.js";
13
13
  import { Text } from "../Text/index.js";
14
14
  const { height } = Dimensions.get('window');
15
15
  const UXModal = /*#__PURE__*/ forwardRef((props, scrollViewRef)=>{
16
- const { style, contentStyle, isOpen, title, titleAlign = 'left', onClose, onVisibleChange, children, disableCloseBySwipe, closeByLineOnly, wrapPortal, footer, modalName, tip, keyboardAvoidPosition = 'container' } = props;
16
+ const { style, contentStyle, isOpen, title, topContent, titleAlign = 'left', onClose, onVisibleChange, children, disableCloseBySwipe, closeByLineOnly, wrapPortal, footer, modalName, tip, keyboardAvoidPosition = 'container', scrollViewProps } = props;
17
+ const { style: scrollViewStyle, ...restScrollViewProps } = scrollViewProps || {};
17
18
  const { modal: modalConfig } = useComponentConfig();
18
19
  const { getColor } = useColors();
19
20
  const { ms } = useMs();
@@ -154,7 +155,7 @@ const UXModal = /*#__PURE__*/ forwardRef((props, scrollViewRef)=>{
154
155
  flex: 1,
155
156
  gap: ms(20),
156
157
  backgroundColor: getColor('overlay'),
157
- maxHeight: isAndroid ? height : height - insets.top,
158
+ maxHeight: height - Math.max(insets.top, ms(40)),
158
159
  transform: [
159
160
  {
160
161
  translateY
@@ -226,17 +227,21 @@ const UXModal = /*#__PURE__*/ forwardRef((props, scrollViewRef)=>{
226
227
  children: title
227
228
  }) : title
228
229
  }) : null,
230
+ topContent,
229
231
  /*#__PURE__*/ jsx(ScrollView, {
230
232
  ref: scrollViewRef,
231
233
  bounces: false,
232
234
  scrollEventThrottle: 16,
233
235
  showsHorizontalScrollIndicator: false,
234
236
  showsVerticalScrollIndicator: false,
237
+ keyboardShouldPersistTaps: "always",
235
238
  style: [
236
239
  styles.content,
237
- contentStyle
240
+ contentStyle,
241
+ scrollViewStyle
238
242
  ],
239
243
  onScroll: handleScroll,
244
+ ...restScrollViewProps,
240
245
  children: children
241
246
  }),
242
247
  /*#__PURE__*/ jsxs(VStack, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-native",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "license": "MIT",
5
5
  "main": "./entry.js",
6
6
  "react-native": "./dist/index.js",