react-notification-system icon indicating copy to clipboard operation
react-notification-system copied to clipboard

Have any way can edit notification message after norification showed?

Open hank7444 opened this issue 10 years ago • 5 comments

as the title, thx!

hank7444 avatar Jan 14 '16 07:01 hank7444

With the current API, no.

Can you provide a scenario for this?

igorprado avatar Jan 14 '16 15:01 igorprado

I use notification for showing loading status, for example, if socket is disconnected, I will reconnect after 30 seconds, I would like to keep notification and countdown at waiting seconds.

image

hank7444 avatar Jan 22 '16 04:01 hank7444

+1 for this, handy when displaying you are fetching data and when success update the same notification

nealoke avatar Jan 12 '17 19:01 nealoke

Here is bad solution, it's working but it doesn't affect level and autoDismiss

    // update existing notification if notification is valid (if not, addNotification throw an exception)
    if (this._notificationSystem.addNotification(notification) == false){
        // get the current notifications list
        var notifications = this._notificationSystem.state.notifications;
        // prepare the new notification list
        var newNotifications = [];
        // push all the notifications in the new list
        notifications.forEach(function (item) {
            if (item.uid == notification.uid){
                // update old notification with the new one
                item = notification;
            }
            newNotifications.push(item);
        });

        // update notificationSystem's notification list
        this._notificationSystem.setState({
            notifications: newNotifications
        });
    }

raphael-thibierge avatar Jan 19 '17 16:01 raphael-thibierge

Sounds reasonable enough. I'll take a look at this task and attempt to provide a PR by the end of the week.

syndbg avatar Mar 14 '17 10:03 syndbg