Skip to content

[SectionList][inverted] SectionList headers are sticky-at-the-top-footers if the list is inverted #18945

Open

Description

@terrysahaidak

Environment

Environment:
OS: macOS High Sierra 10.13.1
Node: 8.6.0
Yarn: 1.5.1
npm: 4.6.1
Watchman: 4.9.0
Xcode: Xcode 9.0.1 Build version 9A1004
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3

Steps to Reproduce

Clone this repository and run it via react-native run-ios.
Observe the section separators are in wrong (randomly?) places.

Expected Behavior

The section list headers should be in the top of the section instead of the bottom like section footers do with an inverted list (but they aren't sticky).

Expected gif:

kapture 2018-04-19 at 13 46 22

Actual Behavior

The section headers are footers instead of headers. They are sticky because of #17762 but still footers, not headers.

Sample code:

export default class App extends React.Component {
  render() {
    return (
      <View style={s.container}>
        <SectionList
          inverted
          sections={mock.sections}
          maxToRenderPerBatch={10}
          initialNumToRender={10}
          style={{ flex: 1 }}
          keyExtractor={(item) => item.messageId}
          renderSectionHeader={sectionProps => (
            <SectionHeader
              {...sectionProps}
            />
          )}
          renderItem={({ item }) => (
            <ListItem
              item={item}
            />
          )}
          ItemSeparatorComponent={ItemSeparator}
        />
        />
      </View>
    );
  }
}

Problem Gif:

kapture 2018-04-19 at 13 43 42

Activity

  1. almorak commented on Jun 25, 2018

    @almorak

    try:
    set sectionlist stickySectionHeadersEnabled={false}
    use renderSectionFooter instead of renderSectionHeader with inverted case

  2. terrysahaidak commented on Jun 25, 2018

    @terrysahaidak
    Author

    @almorak thanks for your advice, but it won't fix the bug at all.
    Sticky headers are common behavior for chat date headers, I still need them.

    Also, see my second issue:
    #18943

  3. terrysahaidak commented on Jun 25, 2018

    @terrysahaidak
    Author

    Hi @janicduplessis, you have worked on support of inverted sticky headers, but there are some issues, could you please look at them?

  4. stale commented on Sep 23, 2018

    @stale

    Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

  5. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Sep 23, 2018
  6. terrysahaidak commented on Sep 23, 2018

    @terrysahaidak
    Author

    Still there is no any workaround or fix for that, so it can't be closed.

  7. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Sep 23, 2018
  8. iamolegga commented on Nov 12, 2018

    @iamolegga

    Any workaround on this?

  9. terrysahaidak commented on Nov 12, 2018

    @terrysahaidak
    Author

    @iamolegga I just don't use section list with sticky headers currently. Just simply FlatList with custom functions for creating sections and then render it.

  10. brunoro commented on Jan 15, 2019

    @brunoro

    Also struggling with this here, I'm implementing infinite scroll to the top and need sticky headers (or inverted footers, apparently). Any solutions so far?

  11. 50 remaining items

  12. cortinico commented on Oct 29, 2024

    @cortinico
    Contributor

    I've pinged a couple of folks internally to look into this 👍

  13. Vinay-Gurjar commented on Feb 4, 2025

    @Vinay-Gurjar

    Problem: renderSectionHeader is appearing after messages instead of before them
    This problem occurs because SectionList is inverted (inverted={true}), which reverses the rendering order of both:
    So use renderSectionFooter instead of actually renderSectionHeader which moves the footer upwards

    `

      <SectionList
                    sections={messageSections}
                    keyExtractor={(item) => item._id}
                    inverted 
                    renderSectionFooter={({ section: { title } }) => (
                        <View key={title} style={{ alignItems: "center", marginVertical: 10, padding:5}}>
                            <View style={{backgroundColor: Colors.subThemeColor, padding: 8, borderRadius: 25}}>
                            <CustomText style={{ fontSize: 13,fontWeight: "bold", color: "#555"}}>{title}</CustomText>
                            </View>
                        </View>
                    )}
                    renderItem={({ item, index }) => renderMessageBubble(item, index)}
                    onEndReached={onLoadMore}
                    onEndReachedThreshold={0.8}
                    ListFooterComponent={loading ? <ActivityIndicator size="small" /> : null}
                />`
    
  14. fangpenlin commented on Feb 6, 2025

    @fangpenlin

    Hey @Vinay-Gurjar thanks for reviewing it. I will find a time looking into this issue and address it.

  15. react-native-bot commented on Aug 6, 2025

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  16. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    and removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Aug 6, 2025
  17. SimpleCreations commented on Aug 6, 2025

    @SimpleCreations
    Contributor

    Still an issue

  18. react-native-bot commented on Feb 3, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  19. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Feb 3, 2026
  20. SimpleCreations commented on Feb 3, 2026

    @SimpleCreations
    Contributor

    Not stale

  21. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Feb 4, 2026
  22. react-native-bot commented on Aug 3, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  23. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Aug 3, 2026
  24. SimpleCreations commented on Aug 3, 2026

    @SimpleCreations
    Contributor

    Not stale

  25. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions