Skip to content

Commit

Permalink
Fix red screen due to ref being undefined in PullRefreshViewAndroid
Browse files Browse the repository at this point in the history
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 #6489

Differential Revision: D3172217

fb-gh-sync-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
fbshipit-source-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
  • Loading branch information
thomdixon authored and Facebook Github Bot 4 committed Apr 19, 2016
1 parent d72f151 commit d586daa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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});
}
});

Expand Down

0 comments on commit d586daa

Please sign in to comment.