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

Add the possibility to customize the scrollbar #6

Closed
frinyvonnick opened this issue Sep 18, 2019 · 11 comments · Fixed by #32
Closed

Add the possibility to customize the scrollbar #6

frinyvonnick opened this issue Sep 18, 2019 · 11 comments · Fixed by #32
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@frinyvonnick
Copy link
Owner

frinyvonnick commented Sep 18, 2019

It would be nice to have the possibility to customize the scrollbar. Here is an example.

There is a codesandbox with a working example of code 👍

@frinyvonnick frinyvonnick added the enhancement New feature or request label Sep 18, 2019
@frinyvonnick frinyvonnick changed the title Add the possibilty to customize the scrollbar Add the possibility to customize the scrollbar Oct 7, 2019
@eduaugustus
Copy link

Hi, can I do this?

@frinyvonnick
Copy link
Owner Author

Hi @eduaugustus 👋 thank you for considering contributing to this project! Sure feel free to open a pull request 👍

@frinyvonnick
Copy link
Owner Author

Hi @eduaugustus, do you need help on this ?

@eduaugustus
Copy link

Hi @frinyvonnick, I been thinkin about the solution, it's ok use react-custom-scrollbar?

@frinyvonnick
Copy link
Owner Author

You mean this repository https://github.com/malte-wessel/react-custom-scrollbars ? Sure it is the one used in the codesandox I linked as example 😉

@eduaugustus
Copy link

ah okay, I'll use this :D

@eduaugustus
Copy link

@frinyvonnick I've been thinking about solution in this weekend. The dev go set a prop in scroolbar like customScroolbar and with this react render a custom default scroolbar or dev should pass custom custom config?

@frinyvonnick
Copy link
Owner Author

You mean something like this:

<InfiniteLoading
  hasMoreItems={hasMore}
  itemHeight={40}
  loadMoreItems={fetchMore}
+ scrollbar
>
  {items.map(item => <div key={item}>{item}</div>)}
</InfiniteLoading>

If scrollbar prop is set we use react-custom-scrollbars otherwise we keep native scrollbar. We can also add a scrollbarProps prop to pass down options to react-custom-scrollbars.

<InfiniteLoading
  hasMoreItems={hasMore}
  itemHeight={40}
  loadMoreItems={fetchMore}
+ scrollbar
+ scrollbarProps={{ universal: true }}
>
  {items.map(item => <div key={item}>{item}</div>)}
</InfiniteLoading>

Does it seems correct?

@eduaugustus
Copy link

eduaugustus commented Oct 20, 2019

@frinyvonnick Hmm this style I think the scroll gonna have many props, I realy been think other way, if you pass customScrollbar prop, scrollbar has a condition render, if is true, render a default custom scrollbar, if false, render normal browser scroll

@eduaugustus
Copy link

@frinyvonnick LOL I'm sorry, I not understand before, but now it's clear, what you say is right hahaha

@frinyvonnick
Copy link
Owner Author

👋 @eduaugustus If you want some help you could create a pull request with your implementation so we could discuss about it together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants