Scrollbar is not showing when component mounts.
See original GitHub issueI have the following scrollbar component:
const CustomScrollbars = ({ children }) => (
<Scrollbars
renderThumbVertical={({ style, ...props }) =>
<div {...props} style={{
...style,
backgroundColor: '#bbb',
borderRadius: '5px',
cursor: 'pointer',
width: '10px',
right: 2,
}}/>
}
>
{children}
</Scrollbars>
);
When the page loads the scrollbar does not appear. When I position the mouse pointer over the content and use the mousewheel to start scrolling, the scrollbar appears.
Having inspected the element using dev tools, the scrollbar is on the page, but the height
of the thumb area is initially 0px
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8
Top Results From Across the Web
How to check to see if a scrollbar is present in React?
It seems to always return true whether a scrollbar is visible or not. The following approach may work for you:.
Read more >Developers - Scrollbar is not showing when component mounts. -
Scrollbar is not showing when component mounts. ... I have the following scrollbar component: const CustomScrollbars = ({ children }) => ( <Scrollbars ......
Read more >::-webkit-scrollbar - CSS: Cascading Style Sheets | MDN
The ::-webkit-scrollbar CSS pseudo-element affects the style of an element's scrollbar when it has overflow:scroll; set.
Read more >Scroll a React component into view - Robin van der Vleuten
We learn how React exposes HTML elements by scrolling an element into ... we grab a user's attention for something that isn't visible...
Read more >Issue with Shelf - scrolling and apps not working
Title: Issue with Shelf - scrolling and apps not working; Device: OnePlus7; Software Version: O2 Stable 191107; Probablility of occurance: 4_50%-100% ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems like the Scrollbar component should call update whenever the scrollbar thumb is likely to change. This is not happening. I did this by creating a ref and calling update on that - a bit hackish, but works until it is fixed internally.
Then call
this.scrollbarRef.current.update()
whenever the scrollbar is expected to change. For me it was on child component resizes. So, I did the following -@uadarsh
Small amendment