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 scolling feature from Lenis #26

Open
nhtoby311 opened this issue Aug 17, 2023 · 3 comments
Open

Infinite scolling feature from Lenis #26

nhtoby311 opened this issue Aug 17, 2023 · 3 comments

Comments

@nhtoby311
Copy link

Is it possible to use Lenis infinite scroll feature, through this library, as an alternative to R3F's <ScrollControls infinite/>?

@ffdead
Copy link
Member

ffdead commented Aug 19, 2023

You can configure Lenis this way:

<SmoothScrollbar config={{ infinite: true }} />

Haven't tested it myself, so depends how Lenis implements the infinite scroll. Let me know how it goes :)

@nhtoby311
Copy link
Author

nhtoby311 commented Aug 19, 2023

I tried to replicate the <ScrollControls infinite/> from drei behavior, by creating a "virtual" scroll <div/>, so the DOM contents won't got affected while user scrolling the scroll bar.

However, it seems to not working well, as I bind the scroll to the custom "virtual" scroll structure, I still can get the data from useScrollbar(), but the scroll bar is not reactive to scroll. This does not happened on example where I don't bind the library in the custom "virtual" scroll.

I have created a minimal examples to describe the problems here: https://codesandbox.io/p/sandbox/clever-danilo-2txxkz?file=/src/App.tsx:15,28

@ffdead
Copy link
Member

ffdead commented Aug 22, 2023

Thanks, unfortunately I don't have time to look into this right now. But thanks for the code sandbox, would be great if you can keep it alive for a while 🙏

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