diff --git a/package-lock.json b/package-lock.json index 340b24b..bf70557 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8906,4 +8906,4 @@ "dev": true } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index a768586..cba0736 100644 --- a/package.json +++ b/package.json @@ -73,4 +73,4 @@ "url": "https://github.com/souhe/reactScrollbar/issues" }, "homepage": "https://github.com/souhe/reactScrollbar" -} +} \ No newline at end of file diff --git a/src/js/ScrollArea.jsx b/src/js/ScrollArea.jsx index ca275da..739ffcd 100644 --- a/src/js/ScrollArea.jsx +++ b/src/js/ScrollArea.jsx @@ -371,10 +371,10 @@ export default class ScrollArea extends React.Component { } computeSizes() { - let realHeight = this.content.offsetHeight; - let containerHeight = this.wrapper.offsetHeight; - let realWidth = this.content.offsetWidth; - let containerWidth = this.wrapper.offsetWidth; + let realHeight = this.content ? this.content.offsetHeight : 0; + let containerHeight = this.wrapper ? this.wrapper.offsetHeight : 0; + let realWidth = this.content ? this.content.offsetWidth : 0; + let containerWidth = this.content ? this.wrapper.offsetWidth : 0; return { realHeight: realHeight,