Fix red screen due to ref being undefined in PullRefreshViewAndroid
Summary:This fixes the error `undefined is not an object (evaluating 'this.refs[NATIVE_REF].setNativeProps')`, which seems to occur when the refresh fails (in our case due to CORS). ![screen shot 2016-03-16 at 12 23 52](https://cloud.githubusercontent.com/assets/461514/13826121/1f8b0aaa-eb73-11e5-81e3-b2c60e536bf0.png) Closes https://github.com/facebook/react-native/pull/6489 Differential Revision: D3172217 fb-gh-sync-id: 5ba3b2653685888f5358ef32b01b441757eff7c8 fbshipit-source-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
This commit is contained in:
parent
d72f151bfc
commit
d586daad51
|
@ -67,7 +67,8 @@ var PullToRefreshViewAndroid = React.createClass({
|
|||
},
|
||||
|
||||
setNativeProps: function(props) {
|
||||
return this.refs[NATIVE_REF].setNativeProps(props);
|
||||
let innerViewNode = this.getInnerViewNode();
|
||||
return innerViewNode && innerViewNode.setNativeProps(props);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -88,7 +89,7 @@ var PullToRefreshViewAndroid = React.createClass({
|
|||
|
||||
_onRefresh: function() {
|
||||
this.props.onRefresh && this.props.onRefresh();
|
||||
this.refs[NATIVE_REF].setNativeProps({refreshing: !!this.props.refreshing});
|
||||
this.setNativeProps({refreshing: !!this.props.refreshing});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue