These styles should be placed here https://github.com/malte-wessel/react-custom-scrollbars/blob/master/src/Scrollbars/styles.js#L43
Otherwise I lose the styles when I overload renderTrackVertical.
As a workaround, you can import defaultRenderElements and customize them, like it's described here
Example with adding custom classes (should works):
import {
renderTrackHorizontalDefault,
renderTrackVerticalDefault,
renderThumbHorizontalDefault,
renderThumbVerticalDefault,
} from 'react-custom-scrollbars/lib/Scrollbars/defaultRenderElements';
const Scrollbar = scrollProps => {
return (
<Scrollbars
renderTrackHorizontal={props => renderTrackHorizontalDefault({ ...props, className: 'track-horizontal' })}
renderTrackVertical={props => renderTrackVerticalDefault({ ...props, className: 'track-vertical' })}
renderThumbHorizontal={props => renderThumbHorizontalDefault({ ...props, className: 'thumb-horizontal' })}
renderThumbVertical={props => renderThumbVerticalDefault({ ...props, className: 'thumb-vertical' })}
{...scrollProps}
/>
);
};
Thanks so much! I just spent about half an hour trying to figure out why copying the example customization code _was not_ working.
Most helpful comment
As a workaround, you can import
defaultRenderElementsand customize them, like it's described hereExample with adding custom classes (should works):