Skip to content

Commit

Permalink
fix(Popup): null component as content
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Aug 1, 2024
1 parent e2e5fcb commit 3ce5cd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ const Popup = forwardRef<PopupRef, PopupProps>((originalProps, ref) => {

// 判断展示浮层
const showOverlay = useMemo(() => {
if (hideEmptyPopup && !content) return false;
const isNullComponent =
React.Children.map(content, (child) => React.isValidElement(child) && (child.type as Function)?.(child.props))
.length === 0;
if (hideEmptyPopup && (!content || isNullComponent)) return false;
return visible || popupElement;
}, [hideEmptyPopup, content, visible, popupElement]);

Expand Down

0 comments on commit 3ce5cd4

Please sign in to comment.