Вы можете следить за этим документом
https://mdbootstrap.com/docs/jquery/javascript/scroll/#smooth-scroll
Вы можете установить позицию scrollY в onScroll
var myCustomScrollbar = document.querySelector('.my-custom-scrollbar');
var ps = new PerfectScrollbar(myCustomScrollbar);
var scrollbarY = myCustomScrollbar.querySelector('.ps.ps--active-y>.ps__scrollbar-y-rail');
myCustomScrollbar.onscroll = function() {
scrollbarY.style.cssText = `top: ${this.scrollTop}px!important; height: 400px; right: ${-this.scrollLeft}px`;
}
В Реакции.Я думаю, что вы можете обновить с помощью полосы прокрутки ref
class Container extends Component {
...
render() {
return (
<ScrollBar
ref = {(ref) => { this._scrollBarRef = ref; }}
>
...
<ChildComponent
onUpdateSize = {() => { this._scrollBarRef.updateScroll(); }}
/>
...
</ScrollBar>
);
}
}