diff --git a/components/ListView.js b/components/ListView.js index 01a28b70..a6e0f6d6 100644 --- a/components/ListView.js +++ b/components/ListView.js @@ -80,6 +80,8 @@ class ListView extends React.Component { // TODO(Braco) - add render separator }; + _isMounted = true; + constructor(props, context) { super(props, context); this.handleListViewRef = this.handleListViewRef.bind(this); @@ -124,6 +126,7 @@ class ListView extends React.Component { // Reset the global network indicator state StatusBar.setNetworkActivityIndicatorVisible(false); } + this._isMounted = false; } onRefresh() { @@ -132,7 +135,18 @@ class ListView extends React.Component { }); if (this.props.onRefresh) { - this.props.onRefresh(); + const callback = this.props.onRefresh(); + const setIdle = () => { + if(this._isMounted) { + this.setState({ + status: Status.IDLE, + }); + } + }; + + if(typeof callback === 'object' && typeof callback.then === 'function') { + callback.then(setIdle, setIdle); + } } }