Fixed: Poor scrolling performance on some browsers

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/496/head
Qstick 6 years ago
parent ca244b0da5
commit 2c492fdb72

@ -13,6 +13,7 @@ class OverlayScroller extends Component {
super(props, context); super(props, context);
this._scroller = null; this._scroller = null;
this._isScrolling = false;
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
@ -20,7 +21,8 @@ class OverlayScroller extends Component {
scrollTop scrollTop
} = this.props; } = this.props;
if (scrollTop != null && scrollTop !== prevProps.scrollTop) { if (!this._isScrolling && scrollTop != null && scrollTop !== prevProps.scrollTop) {
debugger;
this._scroller.scrollTop(scrollTop); this._scroller.scrollTop(scrollTop);
} }
} }
@ -53,12 +55,21 @@ class OverlayScroller extends Component {
// //
// Listers // Listers
onScrollStart = () => {
this._isScrolling = true;
}
onScrollStop = () => {
this._isScrolling = false;
}
onScroll = (event) => { onScroll = (event) => {
const { const {
scrollTop, scrollTop,
scrollLeft scrollLeft
} = event.currentTarget; } = event.currentTarget;
this._isScrolling = true;
const onScroll = this.props.onScroll; const onScroll = this.props.onScroll;
if (onScroll) { if (onScroll) {
@ -84,6 +95,8 @@ class OverlayScroller extends Component {
renderThumbHorizontal={this._renderThumb} renderThumbHorizontal={this._renderThumb}
renderThumbVertical={this._renderThumb} renderThumbVertical={this._renderThumb}
renderView={this._renderView} renderView={this._renderView}
onScrollStart={this.onScrollStart}
onScrollStop={this.onScrollStop}
onScroll={this.onScroll} onScroll={this.onScroll}
> >
{children} {children}

Loading…
Cancel
Save