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:
Thom Dixon 2016-04-19 06:57:51 -07:00 committed by Facebook Github Bot 4
parent d72f151bfc
commit d586daad51
1 changed files with 3 additions and 2 deletions

View File

@ -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});
}
});