react-notifications icon indicating copy to clipboard operation
react-notifications copied to clipboard

Require provision of removeNotification()

Open ashishd751 opened this issue 8 years ago • 1 comments

Hey @minhtranite , Can you please provide us with a solution to remove the notification programatically. Currently, the notification gets removed only after the time-out or onClick of the callback function. We need a provision that allows us to remove the notification at any time (even onClick of the notification).

Thank you.

ashishd751 avatar Feb 20 '17 10:02 ashishd751

Hey guy, what's up?!

I do this:

NotificationManager.create({
  id: 1,
  type: "YOUR TYPE: INFO, ERROR, WARNING, SUCCESS",
  message: "Boladona Message",
  title: "Boladão Title",
  timeOut: 0,
  onClick: () => {
      console.log("Clicked");
  }
});

setTimeout(function () {
  NotificationManager.remove({id: 1});
}, 2000);

The trick is the ID attribute. ;D

Hope this help!

rodrix avatar Apr 06 '17 14:04 rodrix