Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
finnfiddle committed Sep 6, 2018
1 parent 8d834a9 commit e70192b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dist/index.js
Expand Up @@ -97,8 +97,8 @@
var _this = _possibleConstructorReturn(this, (windowSize.__proto__ || Object.getPrototypeOf(windowSize)).call(this));

_this.state = {
width: 0,
height: 0
width: document.body.clientWidth,
height: document.body.clientHeight
};
return _this;
}
Expand All @@ -108,17 +108,17 @@
value: function handleResize() {
// set initial state
this.setState({
width: window.innerWidth,
height: window.innerHeight
width: document.body.clientWidth,
height: document.body.clientHeight
});
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
// bind window resize listeners
this._handleResize = this.handleResize.bind(this);
this._handleResize();
window.addEventListener('resize', this._handleResize);
setTimeout(this._handleResize, 1000);
}
}, {
key: 'componentWillUnmount',
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-window-size",
"version": "1.2.0",
"version": "1.2.2",
"description": "React HOC that passes browser window size to wrapped component",
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions src/index.js
Expand Up @@ -9,23 +9,24 @@ export default (ComposedComponent) => {
constructor() {
super();
this.state = {
width: window.innerWidth,
height: window.innerHeight,
width: document.body.clientWidth,
height: document.body.clientHeight,
};
}

handleResize() {
// set initial state
this.setState({
width: window.innerWidth,
height: window.innerHeight,
width: document.body.clientWidth,
height: document.body.clientHeight,
});
}

componentDidMount() {
// bind window resize listeners
this._handleResize = this.handleResize.bind(this);
window.addEventListener('resize', this._handleResize);
setTimeout(this._handleResize, 1000);
}

componentWillUnmount() {
Expand Down

0 comments on commit e70192b

Please sign in to comment.