Skip to content

Commit c485143

Browse files
author
liuqiang
committed
优化popup组件
1 parent bb94258 commit c485143

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Popup/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
121121
targetHeight,
122122
} = props;
123123

124-
const childNode = typeof popup === 'function' ? popup() : popup;
124+
const childNode =
125+
(open && (typeof popup === 'function' ? popup() : popup)) || null;
125126

126127
// We can not remove holder only when motion finished.
127128
const isNodeVisible = open || keepDom;
@@ -199,6 +200,10 @@ const Popup = React.forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
199200
miscStyle.pointerEvents = 'none';
200201
}
201202

203+
if (!forceRender && !open) {
204+
return null;
205+
}
206+
202207
return (
203208
<Portal
204209
open={forceRender || isNodeVisible}

0 commit comments

Comments
 (0)