Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomedina248 committed May 4, 2022
1 parent a8c87e4 commit 2fd9355
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ControlPopover: React.FC<PopoverProps> = ({
const triggerElementRef = useRef<HTMLElement>();

const [visible, setVisible] = useState(
!!(visibleProp || props.defaultVisible),
visibleProp === undefined ? props.defaultVisible : visibleProp,
);
const [placement, setPlacement] = React.useState<TooltipPlacement>('right');

Expand Down Expand Up @@ -97,13 +97,13 @@ const ControlPopover: React.FC<PopoverProps> = ({
);

const handleOnVisibleChange = useCallback(
(visible: boolean) => {
(visible: boolean | undefined) => {
if (visible === undefined) {
changeContainerScrollStatus(visible);
}

setVisible(!!visible);
props.onVisibleChange?.(visible);
props.onVisibleChange?.(!!visible);
},
[props, changeContainerScrollStatus],
);
Expand All @@ -119,7 +119,9 @@ const ControlPopover: React.FC<PopoverProps> = ({
);

useEffect(() => {
setVisible(!!visibleProp);
if (visibleProp !== undefined) {
setVisible(!!visibleProp);
}
}, [visibleProp]);

useEffect(() => {
Expand Down

0 comments on commit 2fd9355

Please sign in to comment.