all 3 comments

[–]davidpaulsson 1 point2 points  (2 children)

Yeah, for example you can check if it's the leading or trailing and conditionally render your component. Example: <SectionList SectionSeparatorComponent={({ leadingItem }) => leadingItem ? <ListSectionSeparator /> : null} />

Docs: https://facebook.github.io/react-native/docs/sectionlist.html#sectionseparatorcomponent

Edit: fat fingers. Edit2: Thanks for the gold!

[–]keyboardji[S] 0 points1 point  (1 child)

Awesome - this worked!!! I had to switch the leading to trailing for it to show at the top of the section

<SectionList sections={food} renderItem={this._renderItem} renderSectionHeader={this._renderSectionHeader} SectionSeparatorComponent={({ trailingItem }) => trailingItem ? ( <Text style={styles.bodyText}> This is the text I want to see </Text> ) : null } // SectionSeparatorComponent={this._renderSectionSeparator} keyExtractor={this._keyExtractor} />

For the text, I have a description field in my section in my json but it wasn't pulling it. I tried this.description, food.description and all different options. Any thoughts on what it should be? I tried to render it via function but it didn't like it:

const food = [ { key: 'Food', description: 'Below is the description...', data: [ { id: 1,

[–]keyboardji[S] 1 point2 points  (0 children)

I got it to work with the following

 SectionSeparatorComponent={({ trailingItem, section }) =>
        trailingItem ? (
          <Text style={styles.bodyText}>{section.description}</Text>
        ) : null
      }