Use onLayout in listview instead of calling measure for every scroll event.
Reviewed By: sahrens Differential Revision: D2590497 fb-gh-sync-id: 42a8f97dcb43b3a59ba3f0a008fb363f8e8c7200
This commit is contained in:
parent
28b66be7b0
commit
dea4c2ca8e
|
@ -406,6 +406,7 @@ var ListView = React.createClass({
|
|||
// component's original ref instead of clobbering it
|
||||
return React.cloneElement(renderScrollComponent(props), {
|
||||
ref: SCROLLVIEW_REF,
|
||||
onLayout: this._setScrollVisibleLength,
|
||||
}, header, bodyComponents, footer);
|
||||
},
|
||||
|
||||
|
@ -424,11 +425,6 @@ var ListView = React.createClass({
|
|||
logError,
|
||||
this._setScrollContentLength
|
||||
);
|
||||
RCTUIManager.measureLayoutRelativeToParent(
|
||||
React.findNodeHandle(scrollComponent),
|
||||
logError,
|
||||
this._setScrollVisibleLength
|
||||
);
|
||||
|
||||
// RCTScrollViewManager.calculateChildFrames is not available on
|
||||
// every platform
|
||||
|
@ -444,7 +440,8 @@ var ListView = React.createClass({
|
|||
height : width;
|
||||
},
|
||||
|
||||
_setScrollVisibleLength: function(left, top, width, height) {
|
||||
_setScrollVisibleLength: function(event) {
|
||||
var {width, height} = event.nativeEvent.layout;
|
||||
this.scrollProperties.visibleLength = !this.props.horizontal ?
|
||||
height : width;
|
||||
this._updateVisibleRows();
|
||||
|
|
Loading…
Reference in New Issue