diff --git a/src/components/Popover/index.js b/src/components/Popover/index.js index fe04c4d69be6..f2c61b38c008 100644 --- a/src/components/Popover/index.js +++ b/src/components/Popover/index.js @@ -11,39 +11,40 @@ import PopoverWithoutOverlay from '../PopoverWithoutOverlay'; * On small screen widths, it uses BottomDocked modal type, and a Popover type on wide screen widths. */ function Popover(props) { + const {isVisible, onClose, isSmallScreenWidth, fullscreen, animationInTiming, onLayout, animationOutTiming, disableAnimation, withoutOverlay, anchorPosition} = props; // Not adding this inside the PopoverProvider // because this is an issue on smaller screens as well. React.useEffect(() => { const listener = () => { - if (!props.isVisible) { + if (!isVisible) { return; } - props.onClose(); + onClose(); }; window.addEventListener('popstate', listener); return () => { window.removeEventListener('popstate', listener); }; - }, [props.onClose, props.isVisible]); + }, [onClose, isVisible]); - if (!props.fullscreen && !props.isSmallScreenWidth) { + if (!fullscreen && !isSmallScreenWidth) { return createPortal( , document.body, ); } - if (props.withoutOverlay && !props.isSmallScreenWidth) { + if (withoutOverlay && !isSmallScreenWidth) { // eslint-disable-next-line react/jsx-props-no-spreading return createPortal(, document.body); } @@ -52,12 +53,12 @@ function Popover(props) { ); }