How can I permanently display Y scroll bar while using React Infinite Scroll Component?

1.1k Views Asked by At

I previously tried using overflow-y: scroll; in a parent div, which indeed permanently displayed the y scroll bar, but it stopped the React Infinite Scroll Component from triggering the "next" function.

The reason I want to do this is that, without it, the screen flickers while navigating the site. This is caused by the scroll bar being hidden when there are no results (during loading, some pages don't have many results) and being displayed when there are lots of results.

1

There are 1 best solutions below

0
On

I figured out what the problem was. I was adding overflow-y: scroll; to a parent layout div but not to the html body. If I add it to the body, then I can permanently display the scroll bar with overflow-y: scroll and the React Infinite Scroll Component next prop is still triggered on scroll.