Add null check before accessing the refresh control ref
Summary:Unmounting the RefreshControl during onRefresh callback causes the native ref to become null, this simply adds a null check to prevent the crash. Closes https://github.com/facebook/react-native/pull/6931 Differential Revision: D3167637 fb-gh-sync-id: c2420b7a3b672d62dd349a6d35bb05399a00620c fbshipit-source-id: c2420b7a3b672d62dd349a6d35bb05399a00620c
This commit is contained in:
parent
24f03af0c3
commit
eac617d6ee
|
@ -133,7 +133,10 @@ const RefreshControl = React.createClass({
|
||||||
|
|
||||||
_onRefresh() {
|
_onRefresh() {
|
||||||
this.props.onRefresh && this.props.onRefresh();
|
this.props.onRefresh && this.props.onRefresh();
|
||||||
this._nativeRef.setNativeProps({refreshing: this.props.refreshing});
|
|
||||||
|
if (this._nativeRef) {
|
||||||
|
this._nativeRef.setNativeProps({refreshing: this.props.refreshing});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue