diff --git a/components/pull/Pull.tsx b/components/pull/Pull.tsx index c7c093c66..8388d94d3 100644 --- a/components/pull/Pull.tsx +++ b/components/pull/Pull.tsx @@ -22,6 +22,8 @@ export default class Pull extends PureComponent { private wrapTouchstartY; + private mounted = true; + static defaultProps: PullProps = { prefixCls: 'za-pull', refresh: { @@ -49,6 +51,7 @@ export default class Pull extends PureComponent { } componentDidMount() { + this.mounted = true; this.addScrollEvent(); Events.on(this.wrap, 'touchstart', this.wrapTouchstart); Events.on(this.wrap, 'touchmove', this.wrapTouchmove); @@ -89,6 +92,7 @@ export default class Pull extends PureComponent { } 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); @@ -260,6 +264,7 @@ export default class Pull extends PureComponent { 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); @@ -285,6 +290,7 @@ export default class Pull extends PureComponent { case LOAD_STATE.failure: setTimeout(() => { + if (!this.mounted) return; this.doLoadAction(LOAD_STATE.abort); }, stayTime); break;