react-div-100vh
Advanced tools
Comparing version 0.3.2 to 0.3.4
@@ -0,1 +1,4 @@ | ||
## 0.3.3 (Apr 28, 2019) | ||
* Avoid to use jest-get-type in production (@valse in [7](https://github.com/mvasin/react-div-100vh/pull/7)) | ||
## 0.3 (Oct 17, 2018) | ||
@@ -2,0 +5,0 @@ * Get rid of unnecessary handling DOM node via `ref`, because props would do just fine |
@@ -9,6 +9,4 @@ "use strict"; | ||
var _jestGetType = _interopRequireDefault(require("jest-get-type")); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function containsRvh(propertyValue) { | ||
@@ -33,3 +31,3 @@ // TODO: when regexp is lifted up the lexical scope, to be used | ||
function throwOnBadArgs(givenStyle, windowHeight) { | ||
if ((0, _jestGetType.default)(givenStyle) !== 'object' && givenStyle !== undefined) throw Error("style (the first argument) must be an object or undefined"); | ||
if (_typeof(givenStyle) !== 'object' && givenStyle !== undefined || Array.isArray(givenStyle)) throw Error("style (the first argument) must be an object or undefined"); | ||
if (typeof windowHeight !== 'number' || windowHeight < 0) throw Error('Second argument (windowHeight) must be a non-negative number'); | ||
@@ -49,3 +47,3 @@ } | ||
// to px; 1rvh = (window.innerHeight / 100)px | ||
convertedStyle[key] = replaceRvhWithPx(usedStyle[key], windowHeight); | ||
convertedStyle[key] = typeof usedStyle[key] === 'string' ? replaceRvhWithPx(usedStyle[key], windowHeight) : usedStyle[key]; | ||
}); | ||
@@ -52,0 +50,0 @@ return convertedStyle; |
@@ -53,2 +53,11 @@ "use strict"; | ||
}); | ||
it('supports properties with non-string values', function () { | ||
expect((0, _convertStyle.default)({ | ||
lineHeight: 2, | ||
height: '50rvh' | ||
}, 1000)).toEqual({ | ||
lineHeight: 2, | ||
height: '500px' | ||
}); | ||
}); | ||
it('converts rvh to px', function () { | ||
@@ -55,0 +64,0 @@ expect((0, _convertStyle.default)({ |
@@ -13,4 +13,6 @@ "use strict"; | ||
require("./polyfill"); | ||
var _Div100vh = _interopRequireDefault(require("./Div100vh")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
{ | ||
"name": "react-div-100vh", | ||
"version": "0.3.2", | ||
"version": "0.3.4", | ||
"description": "A React component that aims to solve '100vh' issue in mobile browsers", | ||
@@ -16,5 +16,2 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"jest-get-type": "^22.4.3" | ||
}, | ||
"peerDependencies": { | ||
@@ -21,0 +18,0 @@ "react": ">15", |
# `Div100vh` React component | ||
[](https://circleci.com/gh/mvasin/react-div-100vh) | ||
[](https://badge.fury.io/js/react-div-100vh) | ||
@@ -67,1 +68,4 @@ This is a workaround for iOS Safari and other mobile browsers. | ||
Please note that most likely you will want to set `body {margin: 0}` css, unless you use some css reset that does it for you. | ||
## Testing | ||
This component is tested with Jest and <a href="https://www.browserstack.com"><img title="BrowserStack Logo" alt="BrowserStack Logo" height="40" src="images/Browserstack-logo.svg"></a> |
79843
2
24
578
70
- Removedjest-get-type@^22.4.3
- Removedjest-get-type@22.4.3(transitive)