Skip to content

[SectionList][inverted] SectionSeparatorComponent displays in wrong places with inverted list #18943

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 separators should be right after the sections and section headers (like the non-inverted section list does).

I've used the same code as below but without inverted prop.

Expected gif:

kapture 2018-04-19 at 13 23 53

Actual Behavior

The section separator components are in wrong places in the list if the list is inverted. For a non-inverted list, it works as expected.

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}
            />
          )}
          SectionSeparatorComponent={Separator}
          ItemSeparatorComponent={ItemSeparator}
        />
        />
      </View>
    );
  }
}

const Separator = ({ big }) => (
  <View style={[s.separatorContainer, big && s.separatorBig]} />
);

const s = StyleSheet.create({
  container: {
    marginTop: 24,
    flex: 1,
    backgroundColor: 'white',
  },
  sectionContainer: {
    // height: 16,
    marginTop: 8,
    marginBottom: 16,
    backgroundColor: '#b4c5ff',
    borderRadius: 16,
    alignSelf: 'center',
    paddingHorizontal: 8,
    paddingVertical: 4,
  },
  separatorContainer: {
    height: 8,
    backgroundColor: 'gray',
    borderBottomWidth: 1,
    borderTopWidth: 1,
    borderBottomColor: 'blue',
    borderTopColor: 'blue',
  },
});

Problem Gif:

kapture 2018-04-19 at 13 21 10

Activity

  1. stale commented on Jul 18, 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.

  2. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jul 18, 2018
  3. terrysahaidak commented on Jul 18, 2018

    @terrysahaidak
    Author

    Unfortunately, the issue still exists in the latest react native 56, so please don't close:
    kapture_2018-07-18_at_16 20 45

  4. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jul 18, 2018
  5. yanisakli commented on Aug 8, 2018

    @yanisakli

    try stickySectionHeadersEnabled={false}

  6. terrysahaidak commented on Aug 8, 2018

    @terrysahaidak
    Author

    @yanisakli Just tried it out with stickySectionHeaderEnabled={false}.
    Nothing has changed.
    The issue is about gray with blue borders blocks. Here how it should be (it works well without inverted prop):
    image

    And here is with inverted.
    image

  7. earle commented on Sep 5, 2018

    @earle

    To clarify the issue here: The section headers need to render before the section items when the SectionList is inverted -- currently when the SectionList is reversed the section headers are placed after each section

  8. nastynaz commented on Nov 30, 2018

    @nastynaz

    Any updates on this? I'm still getting this issue on the latest version of react native.

  9. terrysahaidak commented on Nov 30, 2018

    @terrysahaidak
    Author

    @nastynaz I did implement my own section-list using flatlist and conditional rendering of the current item, poor performance but at least it works.

  10. 4 remaining items

  11. terrysahaidak commented on Aug 2, 2019

    @terrysahaidak
    Author

    This hasn't been fixed yet.

  12. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Aug 2, 2019
  13. added 3 commits that reference this issue on Oct 21, 2019
  14. added a commit that references this issue on Oct 28, 2019
  15. stale commented on Oct 31, 2019

    @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 a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

  16. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Oct 31, 2019
  17. terrysahaidak commented on Oct 31, 2019

    @terrysahaidak
    Author

    I will check the latest pr and write back here :)

  18. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Oct 31, 2019
  19. stale commented on Jan 30, 2020

    @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 a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

  20. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jan 30, 2020
  21. stale commented on Feb 6, 2020

    @stale

    Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

  22. locked as resolved and limited conversation to collaborators on Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions