Skip to content

First Sticky header gets duplicated if ListHeaderComponent is set #1527

Open
@vendramini

Description

@vendramini

Current behavior

It started happening after I've enabled new RN architecture on Expo 52.

const stickyHeaderIndices = filteredList
    .map((item, index) => {
      if (typeof item === 'string') {
        return index;
      } else {
        return null;
      }
    })
    .filter((item) => item !== null);

  content = (
    <FlashList
      ListHeaderComponent={() => {
        return(
          <Text>ListHeaderComponent here!</Text>
        );
      }}
      ItemSeparatorComponent={() => <DefaultListRowSeparator />}
      contentContainerStyle={styles.contentContainer}
      estimatedItemSize={moderateScale(60)}
      getItemType={(item) => {
        return typeof item === 'string' ? 'sectionHeader' : 'row';
      }}
      stickyHeaderIndices={stickyHeaderIndices}
      data={filteredList}
      renderItem={({ item, target }) => {
        if (typeof item === 'string') {
          return (
            <Text fontFamily={'Poppins_500Medium'} style={styles.sectionHeader(target === 'StickyHeader')}>
              {item}
            </Text>
          );
        } else {
          return (
            <RowLink
              label={item.title}
            />
          );
        }
      }}
    />
  );

Image

If I touch the list the problem gets fixed:

Image

Expected behavior

Do not duplicate the first sticky item on top of ListHeaderComponent.

To Reproduce

Platform:

  • iOS
  • Android

Environment

1.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions