Skip to content

v2: Height of last item is not matching others in the same row when numColumns > 1 #1868

@AndrewMakeApp

Description

@AndrewMakeApp

Current behavior

When numColumns > 1 and ItemSeparatorComponent is used to provide gap between rows. The last item's height is stretched, making it taller than the item in the same row.

Setting a fixed height on each item can fix the issue, by in my case I want it to have a dynamic height.

Image

Expected behavior

The following is the same code using v1.8.0, all item on the same row should have the same height

Image

To Reproduce

    <FlashList
      data={Array.from({ length: 10 }).fill("")}
      numColumns={2}
      renderItem={() => (
        <View
          style={{
            backgroundColor: "green",
            flex: 1,
            justifyContent: "center",
            alignItems: "center",
            padding: 16,
          }}
        >
          <View style={{ backgroundColor: "blue", height: 80, width: 80 }} />
        </View>
      )}
      contentContainerStyle={{
        paddingHorizontal: 16,
      }}
      keyExtractor={(_, i) => i.toString()}
      ItemSeparatorComponent={() => (
        <View style={{ backgroundColor: "yellow", height: 10 }} />
      )}
    />

Platform:

  • iOS
  • Android

Environment

2.0.2

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