Closed 0x0ece closed 6 years ago
I spent a few hours playing around with this:
<SectionList
extraData={this.state.searchString}
getItemLayout={(data, index) => (
{ length: 48, index, offset: this.showSearch() ? 48 : 0 }
)}
keyboardShouldPersistTaps="handled"
initialScrollIndex={1}
ref={(ref) => { this.list = ref; }}
sections={[
{ data: this.showSearch() ? [{ key: 'search' }] : [], renderItem: this.renderSearch },
{ data: groups, renderItem: this.renderGroup },
{ data: services, renderItem: this.renderService },
]}
disableVirtualization
/>
but in the end:
It's certainly a bit cleaner, but it doesn't seem it's worth a refactor now.
We should use SectionList where first section is search (if visibile), next is groups, and last is services.