question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature-request/num-of-columns

See original GitHub issue

Like from FlatList https://reactnative.dev/docs/flatlist#numcolumns.

I actually tried using contentContainerStyle={{ flexDirection: "row", flexWrap: "wrap" }} for little items, but it gave a weird behavior. Given the item header it doesnt consider row, only column.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marcocesaratocommented, Jun 11, 2021

It seems that BigList already have a View as a container, maybe you could get the parent width, by setting your View container to width 100% and access the layout value and do the calculation from that, then any width from BigList parent from the lib consumer, would work, at least in theory, I didnt test this.

It would still need that item width prop.

<View onLayout={(event) => {
  const {x, y, width, height} = event.nativeEvent.layout;
}} />

You mentioned the rendering processor, I dont understand anything from it, so probably I missed something.

The processor that I mean is the following class: https://github.com/marcocesarato/react-native-big-list/blob/master/lib/BigListProcessor.js that process the height and the position of each items depending from the scroll offset of the scroll view. So even you with style it able to render items side by side with column format the processor actually don’t elaborate all items.

In short actually each row is equivalent to the height of the element (like 50) so we know that the third element will be shown at offset scrollview 150 (index: 3 * itemHeight: 50) and this continue until you reach the size of the visible list. But if we have 2 elements per row it means that the third element will be in the 100 position but for the processor it is at 150. Then, when the processor reaches the maximum size of the visible list, it stops rendering the items.

If the maximum size allows you to render 10 elements, with two columns you could render 20 but the processor currently only processes 10 and miss all position of the following elements.

Yesterday I done some tests and tried to implement it but I got some glitches that make it unusable so I need to fix them before release something.

0reactions
dougg0kcommented, Jun 11, 2021

@marcocesarato I just tested, contentContainerStyle is also affecting renderHeader, same thing as just wrapping BigList in a View.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found