From 2c492fdb72eef37c8c70d924de11d7cf0b874fa4 Mon Sep 17 00:00:00 2001 From: Qstick Date: Thu, 13 Sep 2018 22:45:45 -0400 Subject: [PATCH] Fixed: Poor scrolling performance on some browsers Co-Authored-By: Mark McDowall --- .../src/Components/Scroller/OverlayScroller.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/Components/Scroller/OverlayScroller.js b/frontend/src/Components/Scroller/OverlayScroller.js index 9cc9edec0..168173e83 100644 --- a/frontend/src/Components/Scroller/OverlayScroller.js +++ b/frontend/src/Components/Scroller/OverlayScroller.js @@ -13,6 +13,7 @@ class OverlayScroller extends Component { super(props, context); this._scroller = null; + this._isScrolling = false; } componentDidUpdate(prevProps) { @@ -20,7 +21,8 @@ class OverlayScroller extends Component { scrollTop } = this.props; - if (scrollTop != null && scrollTop !== prevProps.scrollTop) { + if (!this._isScrolling && scrollTop != null && scrollTop !== prevProps.scrollTop) { + debugger; this._scroller.scrollTop(scrollTop); } } @@ -53,12 +55,21 @@ class OverlayScroller extends Component { // // Listers + onScrollStart = () => { + this._isScrolling = true; + } + + onScrollStop = () => { + this._isScrolling = false; + } + onScroll = (event) => { const { scrollTop, scrollLeft } = event.currentTarget; + this._isScrolling = true; const onScroll = this.props.onScroll; if (onScroll) { @@ -84,6 +95,8 @@ class OverlayScroller extends Component { renderThumbHorizontal={this._renderThumb} renderThumbVertical={this._renderThumb} renderView={this._renderView} + onScrollStart={this.onScrollStart} + onScrollStop={this.onScrollStop} onScroll={this.onScroll} > {children}