teodosii / react-notifications-component

Delightful and highly customisable React Component to notify your users
https://teodosii.github.io/react-notifications-component/
MIT License
1.27k stars 73 forks source link

onNotificationRemoval not getting called #29

Closed GabrielBB closed 5 years ago

GabrielBB commented 5 years ago

I want to call my function when user clicks the notification. I tried onNotificationRemovalbut is not working. Please, if you know some way i can achieve this, let me know asap :/

store.addNotification({
          title: message.firstName + " is inviting you to play",
          message: "Click here to accept",
          type: "default",
          insert: "top",
          width: 400,
          container: "top-right",
          animationIn: ["animated", "fadeIn"],
          animationOut: ["animated", "fadeOut"],
          onNotificationRemoval: () => this.onAcceptInvitation(message)
        });

image

GabrielBB commented 5 years ago

I could use the containerproperty and use my own component with an onClickevent, but then i would have to make that blue pretty design myself, it would make no sense for me to use this library in that case

teodosii commented 5 years ago

It does get called, but not in the way you did it. onNotificationRemoval is a prop, not an option you supply to addNotification. And for using custom content, you don't need to make your own design, you just need to use existing classes for styling.

You can workaround a solution for this temporary, but as you shown in this example, it would be useful to have onNotificationRemoval as an option tied to the notification. Will do it in 2.1.0 together with the other issue in progress

teodosii commented 5 years ago

Fixed in 2.1.0 - see changelog/readme

GabrielBB commented 4 years ago

@teodosii Great! Thanks