🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-resize-detector

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-resize-detector - npm Package Compare versions

Comparing version

to
9.1.2-beta.0

35

build/index.esm.js

@@ -1,2 +0,2 @@

import React,{isValidElement,createRef,cloneElement,PureComponent,Component,forwardRef,useRef,useState,useCallback,useEffect}from'react';import {findDOMNode}from'react-dom';import debounce from'lodash/debounce';import throttle from'lodash/throttle';/******************************************************************************
import React,{isValidElement,createRef,cloneElement,PureComponent,Component,forwardRef,useRef,useState,useMemo,useCallback,useEffect}from'react';import {findDOMNode}from'react-dom';import debounce from'lodash/debounce';import throttle from'lodash/throttle';/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -288,11 +288,28 @@

}
// this is a callback that will be called every time the ref is changed
// this is a memo that will be called every time the ref is changed
// This proxy will properly call setState either when the ref is called as a function or when `.current` is set
// we call setState inside to trigger rerender
var onRefChange = useCallback(function (node) {
if (node !== refElement) {
setRefElement(node);
}
var refProxy = useMemo(function () {
return new Proxy(function (node) {
if (node !== refElement) {
setRefElement(node);
}
}, {
get: function (target, prop) {
if (prop === 'current') {
return refElement;
}
return target[prop];
},
set: function (target, prop, value) {
if (prop === 'current') {
setRefElement(value);
}
else {
target[prop] = value;
}
return true;
}
});
}, [refElement]);
// adding `current` to make it compatible with useRef shape
onRefChange.current = refElement;
var shouldSetSize = useCallback(function (prevSize, nextSize) {

@@ -353,3 +370,3 @@ if (prevSize.width === nextSize.width && prevSize.height === nextSize.height) {

}, [size]);
return __assign({ ref: onRefChange }, size);
return __assign({ ref: refProxy }, size);
}export{ResizeDetector as default,useResizeDetector,withResizeDetector};//# sourceMappingURL=index.esm.js.map

@@ -288,11 +288,28 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var React=require('react'),reactDom=require('react-dom'),debounce=require('lodash/debounce'),throttle=require('lodash/throttle');/******************************************************************************

}
// this is a callback that will be called every time the ref is changed
// this is a memo that will be called every time the ref is changed
// This proxy will properly call setState either when the ref is called as a function or when `.current` is set
// we call setState inside to trigger rerender
var onRefChange = React.useCallback(function (node) {
if (node !== refElement) {
setRefElement(node);
}
var refProxy = React.useMemo(function () {
return new Proxy(function (node) {
if (node !== refElement) {
setRefElement(node);
}
}, {
get: function (target, prop) {
if (prop === 'current') {
return refElement;
}
return target[prop];
},
set: function (target, prop, value) {
if (prop === 'current') {
setRefElement(value);
}
else {
target[prop] = value;
}
return true;
}
});
}, [refElement]);
// adding `current` to make it compatible with useRef shape
onRefChange.current = refElement;
var shouldSetSize = React.useCallback(function (prevSize, nextSize) {

@@ -353,3 +370,3 @@ if (prevSize.width === nextSize.width && prevSize.height === nextSize.height) {

}, [size]);
return __assign({ ref: onRefChange }, size);
return __assign({ ref: refProxy }, size);
}exports.default=ResizeDetector;exports.useResizeDetector=useResizeDetector;exports.withResizeDetector=withResizeDetector;//# sourceMappingURL=index.js.map
{
"name": "react-resize-detector",
"version": "9.1.1",
"version": "9.1.2-beta.0",
"description": "React resize detector",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -0,0 +0,0 @@ # Handle element resizes like it's 2023!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet