Skip to content
Permalink
Browse files

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 #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 d586daad5164e8ce11137414f4ffe893967c481f
Showing with 3 additions and 2 deletions.
  1. +3 −2 Libraries/PullToRefresh/PullToRefreshViewAndroid.android.js
@@ -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});
}
});

0 comments on commit d586daa

Please sign in to comment.
You can’t perform that action at this time.