mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-06 17:52:57 +08:00
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:
committed by
facebook-github-bot-6
parent
848a151ff8
commit
1195f9c8e8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user