From c4eb65c6b8c4eee0939a63872d9c8f88a8653210 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 4 Oct 2015 22:00:45 +0800 Subject: [PATCH] assign to state fix --- lib/RefresherListView.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/RefresherListView.js b/lib/RefresherListView.js index 7231f07..adbc818 100644 --- a/lib/RefresherListView.js +++ b/lib/RefresherListView.js @@ -102,8 +102,10 @@ class RefresherListView extends React.Component { let threshold = Math.max(Math.min(-offsetY/this.getIndicatorHeight(),1),0); let status = (threshold>=this.state.threshold&&!listviewscroll.scrollResponderIsAnimating()||this.scrolling)?'pull':null; - this.state.loadingStatus = status; - this.state.threshold = threshold; + this.setState({ + loadingStatus: status, + threshold: threshold, + }) changeProps(this.refs.indicator, {threshold, status}); this.lastOffsetY = offsetY; @@ -150,8 +152,10 @@ class RefresherListView extends React.Component { this.updateUIThreshold(this.getIndicatorHeight()); - this.state.loadingStatus = 'loading'; - this.state.threshold = 1; + this.setState({ + loadingStatus: 'loading', + threshold: 1, + }) changeProps(this.refs.indicator, {status: this.state.loadingStatus, threshold:this.state.threshold});