0x0ece / yopa-native

0 stars 2 forks source link

Implement SecretList based on SectionList #90

Closed 0x0ece closed 6 years ago

0x0ece commented 6 years ago

We should use SectionList where first section is search (if visibile), next is groups, and last is services.

0x0ece commented 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.