react-div-100vh
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -0,1 +1,4 @@ | ||
## 0.3.8 (Dec 13, 2019) | ||
* Revert 0.3.6 and 0.3.7 (@mvasin in [29](https://github.com/mvasin/react-div-100vh/pull/29)) | ||
## 0.3.7 (Dec 13, 2019) | ||
@@ -5,3 +8,3 @@ * Fix 'error "document" is not available during server side rendering.' (@kyleboss-tinder in [28](https://github.com/mvasin/react-div-100vh/pull/28)) | ||
## 0.3.6 (Dec 10, 2019) | ||
* Use document.documentElement.clientHeight instead of window.innerHeight (@meyerds in [26](https://github.com/mvasin/react-div-100vh/pull/26)) | ||
* Apply the styles on the first render (@meyerds in [26](https://github.com/mvasin/react-div-100vh/pull/26)) | ||
@@ -8,0 +11,0 @@ ## 0.3.5 (Dec 8, 2019) |
@@ -47,3 +47,5 @@ "use strict"; | ||
function Div100vh(props) { | ||
function Div100vh() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -53,4 +55,12 @@ | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Div100vh).call(this, props)); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Div100vh)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { | ||
style: {} | ||
}); | ||
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateStyle", function () { | ||
@@ -64,13 +74,9 @@ var convertedStyle = (0, _convertStyle.default)(_this.props.style, (0, _getWindowHeight.default)()); | ||
_this.state = { | ||
style: (0, _convertStyle.default)(props.style, (0, _getWindowHeight.default)()) | ||
}; | ||
return _this; | ||
} // On mount and window resize converts rvh values to px (if there are any). | ||
// Also, adds `height: 100rvh` if height is not specified at all | ||
} | ||
_createClass(Div100vh, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.updateStyle(); | ||
window.addEventListener('resize', this.updateStyle); | ||
@@ -77,0 +83,0 @@ } |
@@ -156,18 +156,2 @@ "use strict"; | ||
}); | ||
}); | ||
it('applies the style to the first render', function () { | ||
var component = new _Div100vh.default({ | ||
style: { | ||
height: '50.5rvh' | ||
} | ||
}); | ||
var firstRenderedComponent = _reactTestRenderer.default.create(component.render()); | ||
var props = firstRenderedComponent.root.props; | ||
expect(props).toEqual({ | ||
style: { | ||
height: '505px' | ||
} | ||
}); | ||
}); |
{ | ||
"name": "react-div-100vh", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "A React component that aims to solve '100vh' issue in mobile browsers", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
76405
489