render empty section headers

Summary:Changed behavior so that empty section headers are rendered, fixes this [issue](https://github.com/facebook/react-native/issues/5639).
Closes https://github.com/facebook/react-native/pull/5713

Differential Revision: D3053765

Pulled By: sahrens

fb-gh-sync-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
shipit-source-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
This commit is contained in:
Petr Glotov
2016-03-15 12:13:34 -07:00
committed by Facebook Github Bot 5
parent d5445d5fbc
commit e07fe0cc60
2 changed files with 33 additions and 6 deletions

View File

@@ -186,6 +186,11 @@ class ListViewDataSource {
typeof this._sectionHeaderHasChanged === 'function',
'Must provide a sectionHeaderHasChanged function with section data.'
);
invariant(
!sectionIdentities || !rowIdentities || sectionIdentities.length === rowIdentities.length,
'row and section ids lengths must be the same'
);
var newSource = new ListViewDataSource({
getRowData: this._getRowData,
getSectionHeaderData: this._getSectionHeaderData,
@@ -221,6 +226,10 @@ class ListViewDataSource {
return this._cachedRowCount;
}
getRowAndSectionCount(): number {
return (this._cachedRowCount + this.sectionIdentities.length);
}
/**
* Returns if the row is dirtied and needs to be rerendered
*/