Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-notification

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-notification - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

3

dist/notificationStack.js

@@ -41,5 +41,2 @@ 'use strict';

dismissAfter: isLast ? dismissAfter : dismissAfter + index * 1000,
onClick: function onClick() {
return props.onDismiss(notification);
},
onDismiss: function onDismiss() {

@@ -46,0 +43,0 @@ setTimeout(function () {

10

dist/stackedNotification.js

@@ -44,7 +44,7 @@ 'use strict';

value: function componentDidMount() {
setTimeout(this.setState.bind(this, {
this.activeTimeout = setTimeout(this.setState.bind(this, {
isActive: true
}), 1);
setTimeout(this.setState.bind(this, {
this.dismissTimeout = setTimeout(this.setState.bind(this, {
isActive: false

@@ -54,2 +54,7 @@ }), this.props.dismissAfter);

}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
clearTimeout(this.dismissTimeout);
}
}, {
key: 'render',

@@ -60,3 +65,2 @@ value: function render() {

return _react2.default.createElement(_notification2.default, _extends({}, this.props, {
action: false,
isActive: this.state.isActive,

@@ -63,0 +67,0 @@ barStyle: Object.assign({}, {

@@ -11,28 +11,42 @@ import React, { Component } from 'react';

this.state = {
notifications: OrderedSet(),
notifications: {},
};
// This is just used for the sake of an example to make sure
// notifications have unique keys. In production, you should have
// a different system for UIDs.
count: 0
};
this.removeNotification = this.removeNotification.bind(this);
this.renderNotifications = this.renderNotifications.bind(this);
}
addNotification() {
const { notifications, count } = this.state;
const id = notifications.size + 1;
const newCount = count + 1;
// This is just used for the sake of an example to make sure
// notifications have unique keys. In production, you should have
// a different system for UIDs.
const id = Date.now();
return this.setState({
count: newCount,
notifications: notifications.add({
const notifications = Object.assign({}, this.state.notifications, {
[id]: {
action: 'Dismiss',
dismissAfter: 3400,
onClick: () => this.removeNotification(id),
message: `Notification ${id}`,
key: newCount,
barStyle: {
background: 'grey'
}
})
key: id
}
});
return this.setState({
notifications: notifications
});
}
removeNotification (notif) {
const notifications = Object.assign({}, this.state.notifications);
delete notifications[notif];
this.setState({ notifications })
}
renderNotifications () {
return Object.keys(this.state.notifications).map(notif => this.state.notifications[notif])
}
render() {

@@ -45,6 +59,4 @@ return (

<NotificationStack
notifications={this.state.notifications.toArray()}
onDismiss={notification => this.setState({
notifications: this.state.notifications.delete(notification)
})}
notifications={this.renderNotifications()}
onDismiss={notif => this.removeNotification(notif.key)}
/>

@@ -51,0 +63,0 @@ </div>

{
"name": "react-notification",
"version": "5.0.2",
"version": "5.0.3",
"description": "Snackbar style notification component for React.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -131,2 +131,2 @@ # react-notification

Copyright 2016 Patrick Burtchaell. Licensed MIT.
Copyright 2016 Patrick Burtchaell. Licensed MIT. [Gratipay](https://gratipay.com/~pburtchaell/).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc