@@ -3,34 +3,36 @@ ActionSheet 动作面板
33
44该组件提供了一种动作面板, 底部缓缓出现
55
6- ![ ] ( https://user-images.githubusercontent.com/57083007/137631382-70df5dd3-0200-4ddb-bd11-3578ee99d032.gif ) <!-- rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
6+ <!--  -->
7+ <!-- rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
78
89### 基础示例
10+ ``` jsx mdx:preview
11+ import React , { Fragment , useState } from ' react' ;
12+ import { Button , ActionSheet } from ' @uiw/react-native' ;
13+ import { ActionSheetItem } from ' @uiw/react-native/lib/ActionSheet'
914
10- ``` jsx
11- import { Fragment , useState } from ' react' ;
12- import { ActionSheet , Button ,ActionSheetItem } from ' @uiw/react-native' ;
1315function Demo () {
1416 const [visible , setVisible ] = useState (false )
1517 return (
1618 < Fragment>
1719 < Button onPress= {()=> setVisible (true )}> 打开 ActionSheet< / Button>
18- < ActionSheet
19- visible= {visible}
20- >
20+ < ActionSheet visible= {visible}>
2121 < ActionSheetItem onPress= {()=> console .log (' 按钮一' )}> 按钮一< / ActionSheetItem>
2222 < ActionSheetItem onPress= {()=> console .log (' 按钮二' )}> 按钮二< / ActionSheetItem>
2323 < / ActionSheet>
2424 < / Fragment>
2525 );
2626}
27+ export default Demo
2728```
2829
29- ### 弹层关闭 && 自定义取消文本
30+ ### 自定义按钮文字
31+ ``` jsx mdx:preview
32+ import React , { Fragment , useState } from ' react' ;
33+ import { Button , ActionSheet } from ' @uiw/react-native' ;
34+ import { ActionSheetItem } from ' @uiw/react-native/lib/ActionSheet'
3035
31- ``` jsx
32- import { Fragment , useState } from ' react' ;
33- import { ActionSheet , Button ,ActionSheetItem } from ' @uiw/react-native' ;
3436function Demo () {
3537 const [visible , setVisible ] = useState (false )
3638 return (
@@ -39,56 +41,46 @@ function Demo() {
3941 < ActionSheet
4042 visible= {visible}
4143 onCancel= {true }
42- cancelText= ' 取消 '
44+ cancelText= ' 关闭弹层 '
4345 >
4446 < ActionSheetItem onPress= {()=> console .log (' 按钮一' )}> 按钮一< / ActionSheetItem>
4547 < ActionSheetItem onPress= {()=> console .log (' 按钮二' )}> 按钮二< / ActionSheetItem>
4648 < / ActionSheet>
4749 < / Fragment>
4850 );
4951}
52+ export default Demo
5053```
5154
5255### Props
5356
54- ``` ts
57+ ``` js
5558import { StyleProp , ViewStyle } from ' react-native' ;
5659import { ModalProps } from ' @uiw/react-native' ;
5760
5861export interface DividerStyle {
5962 itemDivider ?: StyleProp <ViewStyle >,
6063 actionDivider ?: StyleProp <ViewStyle >,
6164}
62-
63- export interface ActionSheetProps extends ModalProps {
64- /** 点击蒙层是否关闭 */
65- onCancel? : Boolean ;
66- /** 分割线样式 */
67- dividerStyle? : DividerStyle ;
68- /** 取消的容器样式 */
69- containerStyle? : StyleProp <ViewStyle >;
70- /** 动作在被触摸操作激活时以多少不透明度显示 默认 1 */
71- activeOpacity? : number ;
72- /** 动作有触摸操作时显示出来的底层的颜色 默认 #f1f1f1 */
73- underlayColor? : string ;
74- /** 取消的文本样式 */
75- textStyle? : StyleProp <TextStyle >;
76- /** 取消的文本 */
77- cancelText? : React .ReactNode ;
78- }
7965```
8066
81- ### ActionSheetItem Props
67+ | 参数 | 说明 | 类型 | 默认值 |
68+ | ------| ------| -----| ------|
69+ | onCancel | 点击蒙层是否关闭 | Boolean | ` false ` |
70+ | dividerStyle | 分割线样式 | DividerStyle | - |
71+ | containerStyle | 取消的容器样式 | StyleProp<ViewStyle > | - |
72+ | activeOpacity | 动作在被触摸操作激活时以多少不透明度显示 | number | ` #f1f1f1 ` |
73+ | underlayColor | 动作有触摸操作时显示出来的底层的颜色 | string | ` #f1f1f1 ` |
74+ | cancelText | 取消的文本 | ` React.ReactNode ` | - |
75+ | textStyle | 取消的文本样式 | ` StyleProp<TextStyle> ` | - |
8276
83- ``` ts
77+ ### ActionSheetItem Props
78+ ``` js
8479import { TextStyle , StyleProp , ViewStyle } from ' react-native' ;
80+ ```
8581
86- export interface ActionSheetItemProps {
87- /** 容器样式 */
88- containerStyle? : StyleProp <ViewStyle >;
89- /** 文本样式 */
90- textStyle? : StyleProp <TextStyle >;
91- /** 点击 ActionSheetItem 触发的事件 */
92- onPress? : ((event : GestureResponderEvent ) => void ),
93- }
94- ```
82+ | 参数 | 说明 | 类型 | 默认值 |
83+ | ------| ------| -----| ------|
84+ | containerStyle | 容器样式 | ` StyleProp<ViewStyle> ` | - |
85+ | textStyle | 文本样式 | ` StyleProp<ViewStyle> ` | - |
86+ | onPress | 点击 ActionSheetItem 触发的事件 | ` (event: GestureResponderEvent) => void ` | - |
0 commit comments