-
|
See title. Thanks! 🙏 |
Beta Was this translation helpful? Give feedback.
Answered by
smeijer
Dec 9, 2022
Replies: 1 comment
-
|
If you need to close the inbox programatically, you'll need to take over control over the @magicbell/magicbell-reactWhen using react, you'll need to control the function MyApp() {
const { showInbox } = useContext(AppContext);
return (
<MagicBell apiKey={apiKey} userEmail="[email protected]">
{(props) => (
<FloatingNotificationInbox {…props} isOpen={showInbox} />
)}
</MagicBell>
);
}@magicbell/embeddableThe embeddable currently doesn't expose a way to take over control. You could query the DOM to check the current state tho, and then simulate a click event to close it. const magicbell = document.querySelector('[data-magicbell-bell]');
const expanded = magicbell.closest('[aria-expanded]').getAttribute('aria-expanded') === 'true';
if (expanded) magicbell.click(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
3v0k4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need to close the inbox programatically, you'll need to take over control over the
isOpenprop. The approach depends a bit on what SDK you're using.@magicbell/magicbell-react
When using react, you'll need to control the
isOpenprop. The exact implementation depends very much on your requirements, but here's the basic approach.@magicbell/embeddable
The embeddable currently doesn't expose a way to take over control. You could…