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.

Smarter scroll height for 'variable' mode

See original GitHub issue

On mobile browsers the scrolling is decoupled from the scroll event to maintain 60fps, so in uniform mode it’s important to have the threshold set pretty high (400-1200 depending on the height of rows). Still, if the user scrolls very fast in uniform mode they will scroll faster then the content can be rendered and they’ll see a blank screen until it catches up - not really a big deal.

However in variable mode the height of the scroll is set dynamically as you scroll so scrolling down quickly causes the scrolling to “hit a false bottom” which stops the inertial scrolling - not good. Using an itemSizeGetter would fix the problem but in our case the dynamic height is due to text wrapping so we don’t know the height ahead of time.

So, we need a larger scroll height sooner.

Here’s my idea: add a option minimumRowHeight and add the minimum heights of the remaining rows (the ones with unknown heights) to the total scroll height. As you near the bottom of the scroll there is still a chance of “hitting a false bottom” but it will be much better near the top.

As an alternative, we could average the known row heights and extrapolate that to the remaining rows. This has a chance of over-estimate the scroll height but I’m not sure that’s a very bad thing since it would become more accurate as you get closer to the bottom.

I’m willing to land a pull request for this if you all think it’s a good idea. Thoughts and suggestions?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
caseywebdevcommented, Jun 13, 2016

I think exposing an itemSizeEstimator function would be the most flexible. It would allow you to return a constant if you just want to set some minimum size or do an average of known elements as well.

0reactions
Rob-otcommented, Jun 21, 2016

Good point. As long as estimated values don’t get into the cache I don’t think there’s any issues with this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make scrollviewer work with Height set to Auto in WPF?
In MVVM, the way that worked for me was to bind the height of the ScrollViewer to the ActualHeight of the parent control...
Read more >
Element.scrollHeight - Web APIs | MDN
scrollHeight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to ...
Read more >
Excel Update: Smooth Scrolling Rows and Columns - YouTube
In this video, learn about a new feature update in Excel called Smooth Scrolling which improves the worksheet navigation experience.
Read more >
How to create a virtualized grid with dynamic height support ...
Smart Grid: How to create a virtualized grid with dynamic height support ... Obviously the height of the tables will be the same,...
Read more >
CSS fix for 100vh in mobile WebKit - Matt Smith
When using html, body { height: 100% } I don't have an issue with a sticky element at the bottom of the screen....
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