Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-window flickers #595

Closed
codingedgar opened this issue Dec 12, 2023 · 2 comments
Closed

react-window flickers #595

codingedgar opened this issue Dec 12, 2023 · 2 comments
Labels
🍌 question react Issue has a connection to the React framework.

Comments

@codingedgar
Copy link

codingedgar commented Dec 12, 2023

It took a bit of time, but with v2 OverlayScrollbars should work with all virtual scroll libraries. I've created a small example for FixedSizeList here: https://stackblitz.com/edit/react-8glpkm?file=index.js and also an example with horizontal layout: https://stackblitz.com/edit/react-wdbggw?file=index.js

You can use this approach also for VariableSizeList, FixedSizeGrid and FixedSizeGrid.

Hello, thank you for the library, and sorry for the silly question but, how could I remove the flicker at the start? tried to add data-overlay scrollbars-initialize in https://stackblitz.com/edit/react-8glpkm?file=index.js but there are still a few frames where the initial scrollbar is visible

Originally posted by @codingedgar in #148 (comment)

@KingSora
Copy link
Owner

KingSora commented Dec 12, 2023

Good day @codingedgar

I believe the simplest fix is to remove the defer: true option,

If you wanna keep the defer: true option you can also use CSS to hide the overflow until the plugin is initialized: https://stackblitz.com/edit/react-hbvak1?file=index.js,style.css
The css class .react-window will set the style overflow: hidden !important until OverlayScrollbars is initialized.

If you wanna keep everything in JS you can also use a react state: https://stackblitz.com/edit/react-o8zauw?file=index.js,style.css

@codingedgar
Copy link
Author

That worked perfectly; thank you so much!

@KingSora KingSora added 🍌 question react Issue has a connection to the React framework. labels Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍌 question react Issue has a connection to the React framework.
Projects
None yet
Development

No branches or pull requests

2 participants