From 1f79ea2bcb132de8e44060c19860cdfa86788b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Tue, 30 Jan 2018 18:17:48 +0100 Subject: [PATCH] Performance for smooth-scrollbar --- src/components/base/GrowScroll/index.js | 8 ++++++-- src/components/base/GrowScroll/stories.js | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/base/GrowScroll/index.js b/src/components/base/GrowScroll/index.js index 6992eb3e..0c4523ec 100644 --- a/src/components/base/GrowScroll/index.js +++ b/src/components/base/GrowScroll/index.js @@ -34,11 +34,15 @@ class GrowScroll extends PureComponent { const minY = offsetLimit.y.min if (offset.y > maxY) { - this.scrollTo(offset.x, maxY) + this.setPosition(offset.x, maxY, { + withoutCallbacks: true, + }) } if (offset.y < minY) { - this.scrollTo(offset.x, minY) + this.setPosition(offset.x, minY, { + withoutCallbacks: true, + }) } } }) diff --git a/src/components/base/GrowScroll/stories.js b/src/components/base/GrowScroll/stories.js index d4d9dad2..f921a736 100644 --- a/src/components/base/GrowScroll/stories.js +++ b/src/components/base/GrowScroll/stories.js @@ -7,7 +7,9 @@ import GrowScroll from 'components/base/GrowScroll' const stories = storiesOf('GrowScroll', module) stories.add('basic', () => ( - - {[...Array(1000).keys()].map(v =>
{v}
)}
+ + + {[...Array(1000).keys()].map(v =>
{v}
)} +
))