From d09c1c1086377e1c74232ccb03e33491606fe95b Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 30 Sep 2019 14:39:58 +0300 Subject: [PATCH] fix: fix scrollYOffset when SSR --- src/components/StickySidebar/StickyResponsiveSidebar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/StickySidebar/StickyResponsiveSidebar.tsx b/src/components/StickySidebar/StickyResponsiveSidebar.tsx index 5b4aa394..7159dc1e 100644 --- a/src/components/StickySidebar/StickyResponsiveSidebar.tsx +++ b/src/components/StickySidebar/StickyResponsiveSidebar.tsx @@ -87,7 +87,7 @@ export class StickyResponsiveSidebar extends React.Component< > { static contextType = OptionsContext; context!: React.ContextType; - state: StickySidebarState = {}; + state: StickySidebarState = { offsetTop: '0px' }; stickyElement: Element; @@ -122,7 +122,7 @@ export class StickyResponsiveSidebar extends React.Component< render() { const open = this.props.menu.sideBarOpened; - const top = this.state.offsetTop || this.getScrollYOffset(this.context); + const top = this.state.offsetTop; return ( <>