Updated PopoverBase to hide Popover when reference is hidden

• Updated:
- PopoverBase to hide Popover when reference is hidden
This commit is contained in:
mgabdev 2020-10-28 23:20:33 -05:00
parent 5f801c94e7
commit bec04e2b01

View File

@ -113,14 +113,18 @@ class PopoverBase extends ImmutablePureComponent {
placement={position}
referenceElement={targetRef}
>
{({ ref, style, placement, arrowProps }) => (
<div ref={ref} style={style} data-placement={placement} className={[_s.z4, _s.mt5, _s.mb5, _s.px5, _s.py5].join(' ')}>
<div ref={arrowProps.ref} style={arrowProps.style} />
<div ref={this.setRef} data-popover='true' onKeyDown={this.handleKeyDown} className={containerClasses}>
{children}
{({ ref, style, placement, arrowProps, isReferenceHidden }) => {
if (isReferenceHidden) return null
return (
<div ref={ref} style={style} data-placement={placement} className={[_s.z4, _s.mt5, _s.mb5, _s.px5, _s.py5].join(' ')}>
<div ref={arrowProps.ref} style={arrowProps.style} />
<div ref={this.setRef} data-popover='true' onKeyDown={this.handleKeyDown} className={containerClasses}>
{children}
</div>
</div>
</div>
)}
)
}}
</Popper>
)
}