From 7945e03a0836938f6df95297fab7d5ee0f1aae9e Mon Sep 17 00:00:00 2001 From: wadackel Date: Sun, 17 Jan 2021 17:26:36 +0900 Subject: [PATCH] remove: Disable smooth-scroll #27 --- src/components/VGrid/VGrid.tsx | 9 +++------ src/styles/global-styles.ts | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/components/VGrid/VGrid.tsx b/src/components/VGrid/VGrid.tsx index fa192ea..8dd0bd3 100644 --- a/src/components/VGrid/VGrid.tsx +++ b/src/components/VGrid/VGrid.tsx @@ -172,7 +172,7 @@ export class VGrid extends React.Component< if (hit) { // Notify scrolling to the context because we should not check the hash after the scrolling. this.context.consume(); - setTimeout(() => this.scrollTo(hit.offsetIndex, true)); + setTimeout(() => this.scrollTo(hit.offsetIndex)); } } } @@ -272,7 +272,7 @@ export class VGrid extends React.Component< this.updateCurrentOffsetIndex(); } - private scrollTo(offsetIndex: number, instant = false) { + private scrollTo(offsetIndex: number) { const currentTop = scrollY; const top = this.calculateClientOffsetTop(offsetIndex); const threshold = this.state.visibleItemsLength * this.rowHeightUnit * 1; @@ -288,10 +288,7 @@ export class VGrid extends React.Component< requestAnimationFrame(rafCb); }; requestAnimationFrame(rafCb); - scroll({ - top, - behavior: instant ? (('instant' as unknown) as any) : 'smooth', - }); + scroll({ top }); } private updateCurrentOffsetIndex() { diff --git a/src/styles/global-styles.ts b/src/styles/global-styles.ts index c6d1fbd..57bc0bf 100644 --- a/src/styles/global-styles.ts +++ b/src/styles/global-styles.ts @@ -16,7 +16,6 @@ export const GlobalStyle = createGlobalStyle` -ms-text-size-adjust: 100%; font-family: ${FontFamily.SANS_SERIF}; line-height: ${LineHeight.LARGE}; - scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }