Skip to content

Commit

Permalink
fix(popover): fix popover updateVisible method (#1537)
Browse files Browse the repository at this point in the history
updateVisible method error
  • Loading branch information
berber1016 authored Nov 26, 2021
1 parent efa3788 commit b88a80b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ const Popover = (props: PopoverProps) => {
const updateVisible = useCallback(
(resetVisible: boolean) => {
let realVisible = isUndefined(enterVisible) ? resetVisible : enterVisible;
realVisible = disabled === true ? false : realVisible;
realVisible = disabled ? false : realVisible;

if (!(overContentRef.current && enterable)) {
setVisible(realVisible);
onVisibleChange?.(resetVisible);
onVisibleChange?.(realVisible);
}
if (realVisible) {
update?.();
Expand All @@ -103,7 +104,7 @@ const Popover = (props: PopoverProps) => {
if (!isUndefined(enterVisible)) {
setVisible(enterVisible);
}
if (disabled === true) {
if (disabled) {
setVisible(false);
}
}, [enterVisible, disabled]);
Expand Down Expand Up @@ -234,7 +235,11 @@ const Popover = (props: PopoverProps) => {

const renderContent = (
<>
<ResizeObserver onResize={() => { updateVisible(true) }}>
<ResizeObserver
onResize={() => {
updateVisible(true);
}}
>
{typeof getContainer === 'function'
? ReactDOM.createPortal(contentRender, getContainer(referenceElement as HTMLDivElement))
: contentRender}
Expand Down

1 comment on commit b88a80b

@vercel
Copy link

@vercel vercel bot commented on b88a80b Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.