fix: fix scrollYOffset when SSR

This commit is contained in:
Roman Hotsiy 2019-09-30 14:39:58 +03:00
parent eb8d4fd678
commit d09c1c1086
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -87,7 +87,7 @@ export class StickyResponsiveSidebar extends React.Component<
> {
static contextType = OptionsContext;
context!: React.ContextType<typeof OptionsContext>;
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 (
<>