Hi, can I set ref as a prop for <Scrollbars /> and control scrollbars manually?
usefulMethod() {
this.scrollbars.scrollToBottom();
}
render() {
<Scrollbars ref={s => { this.scrollbars = s; }}>
<div/>
<div/>
</Scrollbars>
}
I correctly understood your question?
I need to have access to the element, not the react-custom-scrollbars's API.
@mhemrg elements are exposed on the API after #155 change.
handleScrollbarsMount(scrollbars) {
const containerElm = scrollbars.container;
const viewElm = scrollbars.view;
const hTrackElm = scrollbars.trackHorizontal;
const hThumbElm = scrollbars.thumbHorizontal;
const vTrackElm = scrollbars.trackVertical;
const vThumbElm = scrollbars.thumbVertical;
}
render() {
<Scrollbars ref={s => { this.handleScrollbarsMount(s); }}>
<div/>
<div/>
</Scrollbars>
}
This would be nice to mention in the docs. :)
Most helpful comment
@mhemrg elements are exposed on the API after #155 change.