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

Infinite list? #67

Open
wtlgo opened this issue Mar 11, 2024 · 2 comments
Open

Infinite list? #67

wtlgo opened this issue Mar 11, 2024 · 2 comments

Comments

@wtlgo
Copy link

wtlgo commented Mar 11, 2024

The description of the library says that it supports an "Infinite list", but I can't figure out how to achieve that.
May someone explain, please?

@pavelbabenko
Copy link
Owner

@wtlgo It means that when you have e.g 5 items, and you're on item-4 (the last one), you will see item-0 on the right side, so you can infinitely scroll with a loop

@wtlgo
Copy link
Author

wtlgo commented Mar 11, 2024

Oh, wouldn't that be called a "looped" gallery then? Well, anyway.
If so, is there any way to feed ~300k items into the gallery without exploding? The performance monitor shows that it tries to render all 300k views at once, and it is a very computationally intensive task.
I came up with an idea to split it into batches of 10 and then feed only 3 batches at once. And whenever the index goes out of the range [10, 20) I switch to another 3 batches and replace the index with 10 or 20 respectfully via ref.current.setIndex(idx). It works, but whenever it switches between batches I get an ugly "blink" because the data and the index are updated at the same time. So, maybe there's a better way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants