Skip to content

Commit beb0efd

Browse files
committed
Removed future deprecated methods
1 parent 05cce40 commit beb0efd

File tree

2 files changed

+24
-30
lines changed

2 files changed

+24
-30
lines changed

src/NotificationContainer.jsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ var NotificationItem = require('./NotificationItem');
44
var Constants = require('./constants');
55

66
class NotificationContainer extends React.Component {
7-
constructor() {
8-
super();
9-
this._style = {};
10-
}
11-
12-
componentWillMount() {
7+
constructor(props) {
8+
super(props);
139
// Fix position if width is overrided
14-
this._style = this.props.getStyles.container(this.props.position);
10+
this._style = props.getStyles.container(props.position);
1511

1612
if (
17-
this.props.getStyles.overrideWidth &&
18-
(this.props.position === Constants.positions.tc ||
19-
this.props.position === Constants.positions.bc)
13+
props.getStyles.overrideWidth &&
14+
(props.position === Constants.positions.tc ||
15+
props.position === Constants.positions.bc)
2016
) {
21-
this._style.marginLeft = -(this.props.getStyles.overrideWidth / 2);
17+
this._style.marginLeft = -(props.getStyles.overrideWidth / 2);
2218
}
2319
}
2420

src/NotificationItem.jsx

+17-19
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function _allowHTML(string) {
3030
}
3131

3232
class NotificationItem extends React.Component {
33-
constructor() {
34-
super();
33+
constructor(props) {
34+
super(props);
3535
this._styles = {};
3636
this._notificationTimer = null;
3737
this._height = 0;
@@ -44,24 +44,11 @@ class NotificationItem extends React.Component {
4444
removed: false
4545
};
4646

47-
this._getCssPropertyByPosition = this._getCssPropertyByPosition.bind(this);
48-
this._defaultAction = this._defaultAction.bind(this);
49-
this._hideNotification = this._hideNotification.bind(this);
50-
this._removeNotification = this._removeNotification.bind(this);
51-
this._dismiss = this._dismiss.bind(this);
52-
this._showNotification = this._showNotification.bind(this);
53-
this._onTransitionEnd = this._onTransitionEnd.bind(this);
54-
this._handleMouseEnter = this._handleMouseEnter.bind(this);
55-
this._handleMouseLeave = this._handleMouseLeave.bind(this);
56-
this._handleNotificationClick = this._handleNotificationClick.bind(this);
57-
}
58-
59-
componentWillMount() {
60-
var getStyles = this.props.getStyles;
61-
var level = this.props.notification.level;
62-
var dismissible = this.props.notification.dismissible;
47+
const getStyles = props.getStyles;
48+
const level = props.notification.level;
49+
const dismissible = props.notification.dismissible;
6350

64-
this._noAnimation = this.props.noAnimation;
51+
this._noAnimation = props.noAnimation;
6552

6653
this._styles = {
6754
notification: getStyles.byElement('notification')(level),
@@ -75,6 +62,17 @@ class NotificationItem extends React.Component {
7562
if (!dismissible || dismissible === 'none' || dismissible === 'button') {
7663
this._styles.notification.cursor = 'default';
7764
}
65+
66+
this._getCssPropertyByPosition = this._getCssPropertyByPosition.bind(this);
67+
this._defaultAction = this._defaultAction.bind(this);
68+
this._hideNotification = this._hideNotification.bind(this);
69+
this._removeNotification = this._removeNotification.bind(this);
70+
this._dismiss = this._dismiss.bind(this);
71+
this._showNotification = this._showNotification.bind(this);
72+
this._onTransitionEnd = this._onTransitionEnd.bind(this);
73+
this._handleMouseEnter = this._handleMouseEnter.bind(this);
74+
this._handleMouseLeave = this._handleMouseLeave.bind(this);
75+
this._handleNotificationClick = this._handleNotificationClick.bind(this);
7876
}
7977

8078
_getCssPropertyByPosition() {

0 commit comments

Comments
 (0)