mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix(tooltip): accessing element.ref was removed in React 19 issue (#4531)
* fix(tooltip): accessing element.ref was removed in React 19 issue * chore(changeset): update package name
This commit is contained in:
parent
0bfc03e675
commit
2573e8269b
5
.changeset/great-feet-lay.md
Normal file
5
.changeset/great-feet-lay.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@heroui/tooltip": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix "Accessing element.ref was removed in React 19" issue (#4526)
|
||||||
@ -48,7 +48,11 @@ const Tooltip = forwardRef<"div", TooltipProps>((props, ref) => {
|
|||||||
ref?: React.Ref<any>;
|
ref?: React.Ref<any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
trigger = cloneElement(child, getTriggerProps(child.props, child.ref));
|
// Accessing the ref from props, else fallback to element.ref
|
||||||
|
// https://github.com/facebook/react/pull/28348
|
||||||
|
const childRef = child.props.ref ?? (child as any).ref;
|
||||||
|
|
||||||
|
trigger = cloneElement(child, getTriggerProps(child.props, childRef));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
trigger = <span />;
|
trigger = <span />;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user