Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ZhongAnTech/zarm
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeLin committed Aug 18, 2020
2 parents f107540 + d370afe commit e5d57c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/pull/Pull.tsx
Expand Up @@ -22,6 +22,8 @@ export default class Pull extends PureComponent<PullProps, any> {

private wrapTouchstartY;

private mounted = true;

static defaultProps: PullProps = {
prefixCls: 'za-pull',
refresh: {
Expand Down Expand Up @@ -49,6 +51,7 @@ export default class Pull extends PureComponent<PullProps, any> {
}

componentDidMount() {
this.mounted = true;
this.addScrollEvent();
Events.on(this.wrap, 'touchstart', this.wrapTouchstart);
Events.on(this.wrap, 'touchmove', this.wrapTouchmove);
Expand Down Expand Up @@ -89,6 +92,7 @@ export default class Pull extends PureComponent<PullProps, any> {
}

componentWillUnmount() {
this.mounted = false;
const scroller = (this.wrap === document.documentElement) ? window : this.wrap;
Events.off(scroller, 'scroll', this.throttledScroll);
Events.off(this.wrap, 'touchstart', this.wrapTouchstart);
Expand Down Expand Up @@ -260,6 +264,7 @@ export default class Pull extends PureComponent<PullProps, any> {
case REFRESH_STATE.failure:
this.doTransition({ offsetY: 'auto', animationDuration });
setTimeout(() => {
if (!this.mounted) return;
this.doRefreshAction(REFRESH_STATE.normal);
this.doLoadAction(LOAD_STATE.normal);
}, stayTime);
Expand All @@ -285,6 +290,7 @@ export default class Pull extends PureComponent<PullProps, any> {

case LOAD_STATE.failure:
setTimeout(() => {
if (!this.mounted) return;
this.doLoadAction(LOAD_STATE.abort);
}, stayTime);
break;
Expand Down

0 comments on commit e5d57c0

Please sign in to comment.