diff --git a/components/SelectableSectionsListView.js b/components/SelectableSectionsListView.js index 0d6d41a..8daf45c 100644 --- a/components/SelectableSectionsListView.js +++ b/components/SelectableSectionsListView.js @@ -104,7 +104,10 @@ export default class SelectableSectionsListView extends Component { if (!this.props.useDynamicHeights) { const cellHeight = this.props.cellHeight; let sectionHeaderHeight = this.props.sectionHeaderHeight; - const keys = Object.keys(this.props.data); + let keys = Object.keys(this.props.data); + if (typeof(this.props.compareFunction) === "function") { + keys = keys.sort(this.props.compareFunction); + } const index = keys.indexOf(section); let numcells = 0; @@ -208,6 +211,11 @@ export default class SelectableSectionsListView extends Component { let sectionList; let renderSectionHeader; let dataSource; + let sections = Object.keys(data); + + if (typeof(this.props.compareFunction) === "function") { + sections = sections.sort(this.props.compareFunction); + } if (dataIsArray) { dataSource = this.state.dataSource.cloneWithRows(data); @@ -216,7 +224,7 @@ export default class SelectableSectionsListView extends Component {