diff --git a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 31204741b..da640b560 100644 --- a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -42,6 +42,10 @@ class ScrollViewStickyHeader extends React.Component { }); this.props.onLayout(event); + const child = React.Children.only(this.props.children); + if (child.props.onLayout) { + child.props.onLayout(event); + } }; render() { @@ -85,7 +89,8 @@ class ScrollViewStickyHeader extends React.Component { onLayout={this._onLayout} style={[child.props.style, styles.header, {transform: [{translateY}]}]}> {React.cloneElement(child, { - style: styles.fill, + style: styles.fill, // We transfer the child style to the wrapper. + onLayout: undefined, // we call this manually through our this._onLayout })} ); diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 09a40dec3..f768c8a03 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -404,6 +404,8 @@ var ListView = React.createClass({ var rowCount = 0; var stickySectionHeaderIndices = []; + const {renderSectionHeader} = this.props; + var header = this.props.renderHeader && this.props.renderHeader(); var footer = this.props.renderFooter && this.props.renderFooter(); var totalIndex = header ? 1 : 0; @@ -427,20 +429,14 @@ var ListView = React.createClass({ } } - if (this.props.renderSectionHeader) { - var shouldUpdateHeader = rowCount >= this._prevRenderedRowsCount && - dataSource.sectionHeaderShouldUpdate(sectionIdx); - bodyComponents.push( - - ); + if (renderSectionHeader) { + bodyComponents.push(React.cloneElement( + renderSectionHeader( + dataSource.getSectionHeaderData(sectionIdx), + sectionID + ), + {key: 's_' + sectionID}, + )); if (this.props.stickySectionHeadersEnabled) { stickySectionHeaderIndices.push(totalIndex++); }