Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ten-paws-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/popover": patch
---

Fix: element.ref was removed in React 19
8 changes: 6 additions & 2 deletions packages/components/popover/src/popover-trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ const PopoverTrigger = forwardRef<"button", PopoverTriggerProps>((props, _) => {
};
}, [children]);

// 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;

const {onPress, isDisabled, ...restProps} = useMemo(() => {
return getTriggerProps(mergeProps(otherProps, child.props), child.ref);
}, [getTriggerProps, child.props, otherProps, child.ref]);
return getTriggerProps(mergeProps(otherProps, child.props), childRef);
}, [getTriggerProps, child.props, otherProps, childRef]);

// validates if contains a NextUI Button as a child
const [, triggerChildren] = pickChildren(children, Button);
Expand Down