parent
7ce1a540bc
commit
aabbcbf41d
|
|
@ -43,6 +43,11 @@ export function useMeasure<T extends Element>() {
|
||||||
const target = ref.current;
|
const target = ref.current;
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const bounds = target.getBoundingClientRect();
|
||||||
|
|
||||||
|
setMeasure(new DOMRect(0, 0, bounds.width, bounds.height));
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver((entries: any) => {
|
const resizeObserver = new ResizeObserver((entries: any) => {
|
||||||
const entry = entries[entries.length - 1];
|
const entry = entries[entries.length - 1];
|
||||||
if (entry && entry.contentRect)
|
if (entry && entry.contentRect)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue