UNPKG

2.96 kBMarkdownView Raw
1# rc-swipeout
2---
3
4iOS-style swipeout buttons that appear from behind a component (web & react-native support)
5
6[![NPM version][npm-image]][npm-url]
7[![build status][travis-image]][travis-url]
8[![Test coverage][coveralls-image]][coveralls-url]
9
10[npm-image]: http://img.shields.io/npm/v/rc-swipeout.svg?style=flat-square
11[npm-url]: http://npmjs.org/package/rc-swipeout
12[travis-image]: https://img.shields.io/travis/react-component/swipeout.svg?style=flat-square
13[travis-url]: https://travis-ci.org/react-component/swipeout
14[coveralls-image]: https://img.shields.io/coveralls/react-component/swipeout.svg?style=flat-square
15[coveralls-url]: https://coveralls.io/r/react-component/swipeout?branch=master
16
17## Screenshots
18
19![rc-swipeout](https://zos.alipayobjects.com/rmsportal/dqxQTtxrKrGMVEc.gif)
20
21## Installation
22
23`npm install --save rc-swipeout`
24
25## Development
26
27```
28web:
29npm install
30npm start
31
32rn:
33tnpm run rn-start
34```
35
36## Example
37
38- local: http://localhost:8000/examples/
39- online: http://react-component.github.io/swipeout/
40
41## react-native
42
43```
44./node_modules/rc-tools run react-native-init
45react-native run-ios
46```
47
48## Usage
49
50```js
51import Swipeout from 'rc-swipeout';
52import 'rc-swipeout/assets/index.less'; (web only)
53
54<Swipeout
55 left={[
56 {
57 text: 'reply',
58 onPress:() => console.log('reply'),
59 style: { backgroundColor: 'orange', color: 'white' },
60 className: 'custom-class-1'
61 }
62 ]}
63 right={[
64 {
65 text: 'delete',
66 onPress:() => console.log('delete'),
67 style: { backgroundColor: 'red', color: 'white' },
68 className: 'custom-class-2'
69 }
70 ]}
71 onOpen={() => console.log('open')}
72 onClose={() => console.log('close')}
73>
74 <div style={{height: 44}}> swipeout demo </div>
75</Swipeout>
76
77```
78
79
80## API
81
82### props
83
84| name | description | type | default |
85|-------------|------------------------|--------|------------|
86| prefixCls | className prefix | String | `rc-swipeout` |
87| style | swipeout style | Object | `` |
88| left | swipeout buttons on left | Array | `[]` |
89| right | swipeout buttons on right | Array | `[]` |
90| autoClose | auto close on button press | Boolean | `function() {}` |
91| onOpen | | Function | `function() {}` |
92| onClose | | Function | `function() {}` |
93| disabled | disabled swipeout | Boolean | `false` |
94
95### button props
96
97| name | description | type | default |
98|-------------|------------------------|--------|------------|
99| text | button text | String | `Click` |
100| style | button style | Object | `` |
101| onPress | button press function | Function | `function() {}` |
102| className | button custom class | String | `` |
103
104## Test Case
105
106```
107npm test
108npm run chrome-test
109```
110
111## Coverage
112
113```
114npm run coverage
115```
116
117open coverage/ dir
118
119## License
120
121rc-swipeout is released under the MIT license.