Skip to content

Commit

Permalink
Merge 8cbefb9 into b6c208e
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinyang committed Jun 7, 2018
2 parents b6c208e + 8cbefb9 commit 7038801
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 18 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ notifications:
email:
- rjmuqiang@gmail.com
- hust2012jiangkai@gmail.com
- quentinyang1985@gmail.com

node_js:
- 6.9.4
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# History

# 2.0.7
- add browserslist config file, then tell babel need to add prefix for `display: flex`.
- refine swipe and demo
- fix: https://github.com/ant-design/ant-design-mobile/issues/1954 (#56)

# 2.0.6

- 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).
Expand Down
7 changes: 7 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Browsers that we support
last 2 versions
Firefox ESR
> 2%
ie >= 8
iOS >= 8
Android >= 4
27 changes: 14 additions & 13 deletions examples/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,22 @@ const SwipeDemo = () => (

ReactDOM.render(
<div style={{ marginBottom: 12 }}>
<div>Basic</div>
<SwipeDemo/>
<div style={{height: 100}}></div>
<SwipeDemo />
<div style={{height: 100}}></div>
<div style={{height: 20}}></div>
<div>Test scroll</div>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<div style={{margin: 20, overflow: 'scroll', height: 500}}>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
<SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/><SwipeDemo/>
</div>
</div>,
document.getElementById('__react-content'),
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-swipeout",
"version": "2.0.6",
"version": "2.0.7",
"description": "swipe out ui component for react(web and react-native)",
"keywords": [
"react",
Expand Down
9 changes: 8 additions & 1 deletion src/Swipeout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ export default class Swipeout extends React.Component <SwipeoutPropType, any> {
) : null;
}

onTouchMove = (e) => {
if (this.swiping) {
e.preventDefault();
}
}

render() {
const { prefixCls, left, right, disabled, children, ...restProps } = this.props;

Expand All @@ -237,12 +243,13 @@ export default class Swipeout extends React.Component <SwipeoutPropType, any> {
};

return (left!.length || right!.length) && !disabled ? (
<div className={cls} {...divProps}>
<div className={cls} {...divProps} >
{/* 保证 body touchStart 后不触发 pan */}
<div className={`${prefixCls}-cover`} ref={(el) => this.cover = el} />
{ this.renderButtons(left, 'left') }
{ this.renderButtons(right, 'right') }
<Gesture
onTouchMove={this.onTouchMove}
onPanStart={this.onPanStart}
onPanMove={this.onPanMove}
onPanEnd={this.onPanEnd}
Expand Down
7 changes: 4 additions & 3 deletions tests/usage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ describe('simple', () => {
it('works when swipe', done => {
const instance = ReactDOM.render(
<Swipeout
left={[
{ text: 'read', style: { width: 80 } },
{ text: 'reply', style: { width: 60 } },
]}
right={[
{ text: 'more', style: { width: 60 }},
{ text: 'delete', style: { width: 60 } },
]} left={[
{ text: 'read', style: { width: 80 } },
{ text: 'reply', style: { width: 60 } },
]}
>
swipeout demo
Expand Down

0 comments on commit 7038801

Please sign in to comment.