react-notification-center
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "react-notification-center", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "react-notification-center keep all your notification in a single place", | ||
@@ -123,4 +123,5 @@ "main": "lib/index.js", | ||
"classnames": "^2.2.3", | ||
"element-class": "^0.2.2", | ||
"eventemitter3": "^1.1.1" | ||
} | ||
} |
import React, {Component, PropTypes} from 'react'; | ||
import cn from 'classnames'; | ||
import elementClass from 'element-class'; | ||
import NotificationItem from './Item'; | ||
@@ -47,2 +48,3 @@ import Header from './header'; | ||
this.toggleNotification = this.toggleNotification.bind(this); | ||
this.timeout = null; | ||
} | ||
@@ -56,10 +58,10 @@ | ||
componentDidUpdate() { | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
if (nextProps.notifications.length !== this.state.notifications.length) { | ||
this.setState({ | ||
notifications: nextProps.notifications | ||
}); | ||
elementClass(this.refs.notificationIcon).add('pulse'); | ||
this.timeout = setTimeout(() => { | ||
elementClass(this.refs.notificationIcon).remove('pulse'); | ||
}, 1200); | ||
this.setState({notifications: nextProps.notifications}); | ||
} | ||
@@ -69,2 +71,5 @@ } | ||
componentWillUnmount() { | ||
if (this.timeout) { | ||
clearTimeout(this.timeout); | ||
} | ||
if (document) { | ||
@@ -161,14 +166,12 @@ document.removeEventListener('click', this.toggleNotification); | ||
} | ||
{this.state.notifications && | ||
<ul className="rn-ul"> | ||
{this.state.notifications.map((item, i) => { | ||
return ( | ||
<NotificationItem | ||
key={i} onClick={this.onItemClick.bind(this, item)} | ||
options={this.mapOptions()} | ||
{...item}/> | ||
); | ||
})} | ||
</ul> | ||
} | ||
<ul className="rn-ul"> | ||
{this.state.notifications.map((item, i) => { | ||
return ( | ||
<NotificationItem | ||
key={i} onClick={this.onItemClick.bind(this, item)} | ||
options={this.mapOptions()} | ||
{...item}/> | ||
); | ||
})} | ||
</ul> | ||
</Content> | ||
@@ -175,0 +178,0 @@ <Footer></Footer> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68091
1136
3
+ Addedelement-class@^0.2.2
+ Addedelement-class@0.2.2(transitive)