Skip to content

Commit

Permalink
Do not handle scroll event on Server Side Rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
maslianok committed Apr 14, 2016
1 parent 3831fd9 commit 125f441
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Vitalii Maslianok <[email protected]> (https://github.com/maslianok)",
"version": "0.3.0",
"version": "0.3.1",
"bugs": {
"url": "https://github.com/maslianok/react-resize-detector/issues"
},
Expand Down
9 changes: 8 additions & 1 deletion src/components/ResizeDetector.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default class ResizeDetector extends Component {
}

reset() {
if (typeof window === 'undefined') {
return;
}

const parent = this.container.parentElement;

let position = 'static';
Expand All @@ -59,6 +63,10 @@ export default class ResizeDetector extends Component {
}

handleScroll() {
if (typeof window === 'undefined') {
return;
}

const { state, props } = this;

if (
Expand All @@ -74,7 +82,6 @@ export default class ResizeDetector extends Component {
render() {
const { state } = this;


const expandStyle = Object.assign({}, expandChildStyle, {
width: state.expandChildWidth,
height: state.expandChildHeight,
Expand Down

0 comments on commit 125f441

Please sign in to comment.