Further improvements in RecyclerViewBackedScrollView.

Summary: public
Changed ListView to use onLayout and onContentSizeChange (new) events instead of measure. Updated ScrollView implementation to support contentSizeChange event with an implementation based on onLayout attached to the content view. For RecyclerViewBackedScrollView we need to generate that event directly as it doesn't have a concept of content view.
This greatly improves performance of ListView that uses RecyclerViewBackedScrollView

Reviewed By: mkonicek

Differential Revision: D2679460

fb-gh-sync-id: ba26462d9d3b071965cbe46314f89f0dcfd9db9f
This commit is contained in:
Krzysztof Magiera
2015-11-20 07:36:23 -08:00
committed by facebook-github-bot-6
parent 848a151ff8
commit 1195f9c8e8
6 changed files with 133 additions and 17 deletions

View File

@@ -71,6 +71,11 @@ var RecyclerViewBackedScrollView = React.createClass({
this.refs[INNERVIEW].setNativeProps(props);
},
_handleContentSizeChange: function(event) {
var {width, height} = event.nativeEvent;
this.props.onContentSizeChange(width, height);
},
render: function() {
var props = {
...this.props,
@@ -92,6 +97,10 @@ var RecyclerViewBackedScrollView = React.createClass({
ref: INNERVIEW,
};
if (this.props.onContentSizeChange) {
props.onContentSizeChange = this._handleContentSizeChange;
}
var wrappedChildren = React.Children.map(this.props.children, (child) => {
if (!child) {
return null;