Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-div-100vh

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-div-100vh - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

13

dist/cjs/index.js

@@ -60,3 +60,3 @@ "use strict";

function use100vh() {
var _a = react_1.useState(measureHeight()), height = _a[0], setHeight = _a[1];
var _a = react_1.useState(measureHeight), height = _a[0], setHeight = _a[1];
var wasRenderedOnClientAtLeastOnce = useWasRenderedOnClientAtLeastOnce();

@@ -68,8 +68,7 @@ react_1.useEffect(function () {

var measuredHeight = measureHeight();
if (height !== measuredHeight)
setHeight(measuredHeight);
setHeight(measuredHeight);
}
window.addEventListener('resize', setMeasuredHeight);
return function () { return window.removeEventListener('resize', setMeasuredHeight); };
}, [height, wasRenderedOnClientAtLeastOnce]);
}, [wasRenderedOnClientAtLeastOnce]);
return wasRenderedOnClientAtLeastOnce ? height : null;

@@ -92,10 +91,10 @@ }

react_1.useEffect(function () {
if (isClient() && !wasRenderedOnClientAtLeastOnce) {
if (isClient()) {
setWasRenderedOnClientAtLeastOnce(true);
}
}, [wasRenderedOnClientAtLeastOnce]);
}, []);
return wasRenderedOnClientAtLeastOnce;
}
function isClient() {
return typeof window !== 'undefined';
return typeof window !== 'undefined' && typeof document !== 'undefined';
}

@@ -37,3 +37,3 @@ var __assign = (this && this.__assign) || function () {

export function use100vh() {
var _a = useState(measureHeight()), height = _a[0], setHeight = _a[1];
var _a = useState(measureHeight), height = _a[0], setHeight = _a[1];
var wasRenderedOnClientAtLeastOnce = useWasRenderedOnClientAtLeastOnce();

@@ -45,8 +45,7 @@ useEffect(function () {

var measuredHeight = measureHeight();
if (height !== measuredHeight)
setHeight(measuredHeight);
setHeight(measuredHeight);
}
window.addEventListener('resize', setMeasuredHeight);
return function () { return window.removeEventListener('resize', setMeasuredHeight); };
}, [height, wasRenderedOnClientAtLeastOnce]);
}, [wasRenderedOnClientAtLeastOnce]);
return wasRenderedOnClientAtLeastOnce ? height : null;

@@ -67,10 +66,10 @@ }

useEffect(function () {
if (isClient() && !wasRenderedOnClientAtLeastOnce) {
if (isClient()) {
setWasRenderedOnClientAtLeastOnce(true);
}
}, [wasRenderedOnClientAtLeastOnce]);
}, []);
return wasRenderedOnClientAtLeastOnce;
}
function isClient() {
return typeof window !== 'undefined';
return typeof window !== 'undefined' && typeof document !== 'undefined';
}
{
"name": "react-div-100vh",
"version": "0.5.5",
"version": "0.5.6",
"description": "A workaround for the '100vh' issue in mobile browsers",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc