Skip to content

Commit 4ba4365

Browse files
committed
doc:SwipeAction文档优化
1 parent edefc58 commit 4ba4365

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/SwipeAction/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ SwipeAction 滑动操作组件。
55
### 基础示例
66

77
```jsx
8-
import React from 'react';
8+
import React,{ useRef } from 'react';
99
import {SwipeAction} from '@uiw/react-native';
1010
import { View,Text } from 'react-native'
1111

1212
function Demo() {
13+
const ref = useRef()
1314
const right = [
1415
{
1516
text: '查看',
1617
color: 'orange',
1718
x: 250,
19+
onPress: () => ref?.current?.swipeable.close()
1820
},
1921
{
2022
text: '删除',
@@ -28,7 +30,7 @@ function Demo() {
2830
},
2931
];
3032
return (
31-
<SwipeAction buttonWidth={60} right={right}>
33+
<SwipeAction ref={ref} buttonWidth={60} right={right}>
3234
<View><Text>滑动</Text></View>
3335
</SwipeAction>
3436
);
@@ -42,7 +44,7 @@ export default Demo;
4244
|------|------|-----|------|
4345
| `right` | 右边滑动出来的元素 | Array<Column> | - |
4446
| `left` | 左边滑动出来的元素 | Array<Column> | - |
45-
| `buttonWidth` | 按钮宽度 | string | number | 60 |
47+
| `buttonWidth` | 按钮宽度 | number | 60 |
4648
4749
### ColumnProps
4850
| 参数 | 说明 | 类型 | 默认值 |

0 commit comments

Comments
 (0)