I'm passing a ListViewDataSource
down as a prop and want the child element to detect whether it's empty or not.
Debugging in Chrome, I see that the _cachedRowCount
property is set to 0
when the list is empty.
Is there a better way to detect whether the list view is empty?
Try getRowCount()
, for instance:
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
let dataSource = ds.cloneWithRows(this.state.rows || [])
console.log(dataSource.getRowCount())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With