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:
Krzysztof Magiera 2015-10-28 12:37:30 -07:00 committed by facebook-github-bot-9
parent 28b66be7b0
commit dea4c2ca8e
1 changed files with 3 additions and 6 deletions

View File

@ -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();