You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by radix February 8, 2023
When I want to render a popover, but I have a regular old prop that I want to use to control whether the popover is visible, I have to jump through hoops to make Whisper work: use trigger="none", create a ref for the Whisper, and then have a useEffect depending on my prop to call ref.open() or ref.close().
My first thought was to just use Popover by itself, which is close, but it doesn't give me any placement options, so I browsed the code some more and found out that the placement is handled by a component called Overlay, which Whisper wraps around the speaker (via OverlayTrigger).
Unfortunately, not only is Overlay undocumented, I couldn't quite figure out how to use it even with browsing the source; there's some context called OverlayContext that it seems to depend on and which applications can't import. I almost got this working by just calling usePortal with a context of undefined, but that doesn't seem to be the same behavior that I got with Whisper.
I would hope that I should just be able to write something like <Overlay open={myProp}><Popover>...</Popover></Overlay>.
The text was updated successfully, but these errors were encountered:
Discussed in https://github.com/orgs/rsuite/discussions/3061
Originally posted by radix February 8, 2023
When I want to render a popover, but I have a regular old prop that I want to use to control whether the popover is visible, I have to jump through hoops to make Whisper work: use
trigger="none"
, create a ref for the Whisper, and then have auseEffect
depending on my prop to call ref.open() or ref.close().My first thought was to just use Popover by itself, which is close, but it doesn't give me any placement options, so I browsed the code some more and found out that the placement is handled by a component called
Overlay
, whichWhisper
wraps around the speaker (viaOverlayTrigger
).Unfortunately, not only is
Overlay
undocumented, I couldn't quite figure out how to use it even with browsing the source; there's some context calledOverlayContext
that it seems to depend on and which applications can't import. I almost got this working by just callingusePortal
with a context ofundefined
, but that doesn't seem to be the same behavior that I got withWhisper
.I would hope that I should just be able to write something like
<Overlay open={myProp}><Popover>...</Popover></Overlay>
.The text was updated successfully, but these errors were encountered: