[ReactNative] Fix crash in ListView

This commit is contained in:
Spencer Ahrens
2015-07-13 12:27:02 -07:00
parent 9f07b9a2b6
commit e5f7200213
2 changed files with 8 additions and 3 deletions

View File

@@ -221,7 +221,9 @@ var ListView = React.createClass({
* such as scrollTo.
*/
getScrollResponder: function() {
return this.refs[SCROLLVIEW_REF].getScrollResponder();
return this.refs[SCROLLVIEW_REF] &&
this.refs[SCROLLVIEW_REF].getScrollResponder &&
this.refs[SCROLLVIEW_REF].getScrollResponder();
},
setNativeProps: function(props) {
@@ -400,6 +402,9 @@ var ListView = React.createClass({
_measureAndUpdateScrollProps: function() {
var scrollComponent = this.getScrollResponder();
if (!scrollComponent || !scrollComponent.getInnerViewNode) {
return;
}
RCTUIManager.measureLayout(
scrollComponent.getInnerViewNode(),
React.findNodeHandle(scrollComponent),