The isOpen of FloatingNotificationInbox does not work as expected #143
-
| I use a custom NotificationItem so I have to handle my redirection with the actionUrl. The problem is that after I change the value to false from the click on my Notification, the FloatingNotificationInbox won't open again from clicking the bell even if I can see that the value of isPanelOpen is changing properly. | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| Hi @EtienneBBlache , can you please upgrade to  FYI: here's the changelog with an example showing how to control the state: https://github.com/magicbell-io/magicbell-js/blob/main/packages/react/CHANGELOG.md#1093 Copy from that changelog: function App() {
  const [isOpen, setIsOpen] = React.useState(false);
  const open = () => setIsOpen(true);
  const close = () => setIsOpen(false);
  const toggle = () => setIsOpen((open) => !open);
  return (
    <>
      <button type="button" onClick={open}>open</button>
      <button type="button" onClick={close}>close</button>
      <button type="button" onClick={toggle}>toggle</button>
      <MagicBell apiKey="__API_KEY__" userEmail="__USER_EMAIL__" onToggle={toggle} isOpen={isOpen}>
        {(props) => <FloatingNotificationInbox height={450} {...props} />}
      </MagicBell>
    </>
  );
}I hope this helps. | 
Beta Was this translation helpful? Give feedback.

 
      
Hi @EtienneBBlache , can you please upgrade to
@magicbell/[email protected], and move theisOpenprop from theFloatingNotifcationInboxcomponent to theMagicBellcomponent? I've just published a fix that should correct this, but theisOpenprop needs to be on the provider, as thechildrenof that component aren't rendered whenisOpenisfalse. You can also remove thetoggleproperty from theFloatingNotifcationInboxas theMagicBellprovider overrides it.FYI: here's the changelog with an example showing how to control the state: https://github.com/magicbell-io/magicbell-js/blob/main/packages/react/CHANGELOG.md#1093
Copy from that changelog: