├── .gitignore
├── .travis.yml
├── HISTORY.md
├── README.md
├── assets
└── index.less
├── browserslist
├── examples
├── left.html
├── left.native.tsx
├── left.tsx
├── mutiple.html
├── mutiple.tsx
├── right.html
├── right.native.tsx
├── right.tsx
├── simple.html
├── simple.native.tsx
└── simple.tsx
├── index.android.js
├── index.ios.js
├── index.js
├── package.json
├── src
├── PropTypes.tsx
├── Swipeout.native.tsx
├── Swipeout.tsx
├── index.native.tsx
└── index.tsx
├── tests
├── index.js
└── usage.tsx
├── tsconfig.json
└── typings
├── custom.d.ts
└── index.d.ts
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .idea/
3 | .ipr
4 | .iws
5 | *~
6 | ~*
7 | *.diff
8 | *.patch
9 | *.bak
10 | .DS_Store
11 | Thumbs.db
12 | .project
13 | .*proj
14 | .svn/
15 | *.swp
16 | *.swo
17 | *.pyc
18 | *.pyo
19 | *.log
20 | *.log.*
21 | node_modules
22 | dist
23 | build
24 | lib
25 | coverage
26 | _ts2js
27 | es
28 | ios
29 | android
30 | yarn.lock
31 | assets/index.css
32 | package-lock.json
33 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | notifications:
4 | email:
5 | - rjmuqiang@gmail.com
6 | - hust2012jiangkai@gmail.com
7 | - quentinyang1985@gmail.com
8 |
9 | node_js:
10 | - 6.9.4
11 |
12 | before_install:
13 | - |
14 | if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
15 | then
16 | echo "Only docs were updated, stopping build process."
17 | exit
18 | fi
19 | phantomjs --version
20 | script:
21 | - |
22 | if [ "$TEST_TYPE" = test ]; then
23 | npm test
24 | else
25 | npm run $TEST_TYPE
26 | fi
27 | env:
28 | matrix:
29 | - TEST_TYPE=lint
30 | - TEST_TYPE=test
31 | - TEST_TYPE=coverage
32 |
33 | matrix:
34 | allow_failures:
35 | - env: "TEST_TYPE=saucelabs"
36 |
--------------------------------------------------------------------------------
/HISTORY.md:
--------------------------------------------------------------------------------
1 | # History
2 |
3 | # 2.0.7
4 | - add browserslist config file, then tell babel need to add prefix for `display: flex`.
5 | - refine swipe and demo
6 | - fix: https://github.com/ant-design/ant-design-mobile/issues/1954 (#56)
7 |
8 | # 2.0.6
9 |
10 | - fix: https://github.com/ant-design/ant-design-mobile/issues/1954 As rc-gesture revert preventDefault in v0.0.19 for tabs+listview issue (https://github.com/ant-design/ant-design-mobile/issues/2589).
11 | - Then, rc-gesture@v0.0.20 fixed this issue by exposing the `event` as a property of Gesture object, and the Gesture object will be passed as the first parameter when invoked panMove event callback.
12 | - So, `rc-swipeout` invokes `event.preventDefault()` to prevent scroll event when pan moving.
13 |
14 | # 2.0.0
15 |
16 | - replace `hammer.js` width [rc-gesture](https://github.com/react-component/gesture)
17 |
18 | # 1.4.5
19 |
20 | - replace `object.omit`, update style
21 |
22 | # ~1.4.4
23 |
24 | - improve: disabled swipe if deltaX < deltaY
25 |
26 | # 1.4.0
27 |
28 | - improve: auto width for swipe buttons, #40
29 |
30 | # 1.3.8
31 |
32 | - fixed: only one hand can be swiped if left or right is null.
33 |
34 | # ~1.3.7
35 |
36 | - fixed `removeEventListener` bug;
37 | - fixed binding and unbinding event bug;
38 | - support es module;
39 | - update deps;
40 |
41 | # 1.3.1
42 |
43 | - update react-native-swipeout version
44 |
45 | # 1.2.7
46 |
47 | - new: role="button"
48 |
49 | # 1.2.6
50 |
51 | - new: support `className` for button;
52 |
53 | # 1.2.5
54 |
55 | - fix: onCloseSwipe prefixCls bug;
56 |
57 | ## 1.2.3
58 |
59 | - add cover `div`, for body touchstart
60 | - fix: buttons cannot be hidden when pan short distance
61 |
62 | ## 1.2.2
63 |
64 | - prevent default of event;
65 |
66 | ## 1.2.1
67 |
68 | - support `onClose` for rn;
69 |
70 | ## 1.2.0
71 |
72 | - click body to close swipe buttons; #19, #10
73 | - support event arg for onPress; #18
74 | - swipe to close for web;
75 |
76 | ## 1.1.5
77 |
78 | - fix issue/9
79 |
80 | ## 1.1.4
81 |
82 | - use babel-runtime
83 |
84 | ## 1.1.3
85 |
86 | - update deps
87 |
88 | ## 1.1.0
89 |
90 | - [`new`] react-native support
91 |
92 | ## 1.0.2
93 |
94 | - [`fix`] error if this.refs.left/right is []
95 |
96 | ## 1.0.1
97 | - [`fix`] npm package empty
98 |
99 | ## 1.0.0
100 | init project
101 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rc-swipeout
2 | ---
3 |
4 | iOS-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 | 
20 |
21 | ## Installation
22 |
23 | `npm install --save rc-swipeout`
24 |
25 | ## Development
26 |
27 | ```
28 | web:
29 | npm install
30 | npm start
31 |
32 | rn:
33 | tnpm 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
45 | react-native run-ios
46 | ```
47 |
48 | ## Usage
49 |
50 | ```js
51 | import Swipeout from 'rc-swipeout';
52 | import 'rc-swipeout/assets/index.less'; (web only)
53 |
54 |
多个实例:
22 | {this.state.items.map((item, i) =>