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.

Is it possible to pre-compute all row heights?

See original GitHub issue

I’m trying to build a chat app, but the size of messages could vary wildly. The chat starts from the bottom (so I want to use initialTopMostItemIndex={messages.length - 1}.

The problem is that because you can have large differences message heights, when you scroll up it is very janky.

This is only a problem because obviously the height of each row has not been computed, so it is computing them on the way up.

#44 I checked this out and had hope for the <Virtuoso style={{rotate(180deg) scaleX(-1)}}> solution presented by @iJimmyWei, but unfortunately, it messes up the scrollbar direction, so it isn’t usable.

Possibly a feature request, but Is there a way to pre-compute all row heights? Perhaps via a prop? It’s not feasible for all products, but for some, it won’t actually impact performance much I imagine.

Another change would be to measure all the rows on the way down in initialTopMostItemIndex but I fear that could be expensive.

I’m exploring this project as a replacement for react-virtualized in my current project which while great can be a nightmare to get some features to work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jmeistrichcommented, Jun 6, 2020

I was encountering a similar problem and I noticed scroll was stuttering only if the initially topmost item was unusually large. Setting defaultItemHeight to my lists’s minimum item size solved the problem for me. @dilizarov Maybe that will fix it for you? @petyosi I can’t quite follow the internal logic of how defaultItemHeight is used, but if no default is provided would using the minimum size of all rendered items as the expected default work better?

0reactions
petyosicommented, Nov 26, 2020

The problem is that because you can have large differences message heights, when you scroll up it is very janky.

This should work fine in v1, see #203 for instructions on upgrade.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change the column width and row height - Microsoft Support
Under Cell Size, click AutoFit Row Height. Tip: To quickly autofit all rows on the worksheet, click the Select All button, and then...
Read more >
Calculate scrollbar height in grid with varied row height
Let the scroll be in pixel units: Sum the total height of all the rows and set the scrollbar max value to that...
Read more >
How to Make All Excel Rows the Same Height
1. Select the rows you want to resize. · 2. Click on the "Format" item in the Home tab's Cells group. · 3....
Read more >
How to change and AutoFit row height in Excel - Ablebits
Method 2. On the Home tab, in the Cells group, click Format > AutoFit Row Height: Tip. To auto fit all rows on...
Read more >
matplotlib.pyplot.subplots — Matplotlib 3.6.2 documentation
Defines the relative heights of the rows. Each row gets a relative height of height_ratios[i] / sum(height_ratios) . If not given, all rows...
Read more >

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