[ReactNative] Fix crash in ListView
This commit is contained in:
parent
9f07b9a2b6
commit
e5f7200213
|
@ -221,7 +221,9 @@ var ListView = React.createClass({
|
||||||
* such as scrollTo.
|
* such as scrollTo.
|
||||||
*/
|
*/
|
||||||
getScrollResponder: function() {
|
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) {
|
setNativeProps: function(props) {
|
||||||
|
@ -400,6 +402,9 @@ var ListView = React.createClass({
|
||||||
|
|
||||||
_measureAndUpdateScrollProps: function() {
|
_measureAndUpdateScrollProps: function() {
|
||||||
var scrollComponent = this.getScrollResponder();
|
var scrollComponent = this.getScrollResponder();
|
||||||
|
if (!scrollComponent || !scrollComponent.getInnerViewNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
RCTUIManager.measureLayout(
|
RCTUIManager.measureLayout(
|
||||||
scrollComponent.getInnerViewNode(),
|
scrollComponent.getInnerViewNode(),
|
||||||
React.findNodeHandle(scrollComponent),
|
React.findNodeHandle(scrollComponent),
|
||||||
|
|
|
@ -157,8 +157,8 @@ class MessageQueue {
|
||||||
let callback = this._callbacks[cbID];
|
let callback = this._callbacks[cbID];
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
let debug = this._debugInfo[cbID >> 1];
|
let debug = this._debugInfo[cbID >> 1];
|
||||||
let module = this._remoteModuleTable[debug[0]];
|
let module = debug && this._remoteModuleTable[debug[0]];
|
||||||
let method = this._remoteMethodTable[debug[0]][debug[1]];
|
let method = debug && this._remoteMethodTable[debug[0]][debug[1]];
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
console.error(`Callback with id ${cbID}: ${module}.${method}() not found`);
|
console.error(`Callback with id ${cbID}: ${module}.${method}() not found`);
|
||||||
} else if (SPY_MODE) {
|
} else if (SPY_MODE) {
|
||||||
|
|
Loading…
Reference in New Issue