From 2b74ff532e7d9ab2f5cc3d7f2086b67463b2800c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Nain?= Date: Sat, 15 Apr 2017 17:32:46 +0200 Subject: [PATCH 1/3] Update NotificationItem.jsx Remove of the height reset on render. This fixes the height of the notification, and prevents having dynamic children (with variable height) to be displayed properly. Should also help in closing #77. --- src/NotificationItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NotificationItem.jsx b/src/NotificationItem.jsx index a8e1fbb..882ba34 100644 --- a/src/NotificationItem.jsx +++ b/src/NotificationItem.jsx @@ -264,7 +264,7 @@ var NotificationItem = React.createClass({ } if (this.state.visible && !this.state.removed) { - notificationStyle.height = this._height; + //notificationStyle.height = this._height; // this prevents having an automated height when placing high children in notification notificationStyle[cssByPos.property] = 0; } From d61551b3d9799fb1ccda6dca8286ecf2203ade24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Nain?= Date: Tue, 25 Apr 2017 18:08:03 +0200 Subject: [PATCH 2/3] Update NotificationSystem.jsx Moving the call to onAdd, in the callback of setState --- src/NotificationSystem.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/NotificationSystem.jsx b/src/NotificationSystem.jsx index adbef3e..cba2586 100644 --- a/src/NotificationSystem.jsx +++ b/src/NotificationSystem.jsx @@ -141,14 +141,13 @@ var NotificationSystem = React.createClass({ notifications.push(_notification); - if (typeof _notification.onAdd === 'function') { - notification.onAdd(_notification); - } - this.setState({ notifications: notifications + },()=>{ + if (typeof _notification.onAdd === 'function') { + notification.onAdd(_notification); }); - + return _notification; }, From 1a3f91eaba6818747d8cf3192086dc966d059ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Nain?= Date: Tue, 25 Apr 2017 18:17:47 +0200 Subject: [PATCH 3/3] Update NotificationSystem.jsx Fix --- src/NotificationSystem.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/NotificationSystem.jsx b/src/NotificationSystem.jsx index cba2586..d39ed4f 100644 --- a/src/NotificationSystem.jsx +++ b/src/NotificationSystem.jsx @@ -139,15 +139,16 @@ var NotificationSystem = React.createClass({ } } - notifications.push(_notification); + notifications.push(_notification); this.setState({ notifications: notifications - },()=>{ - if (typeof _notification.onAdd === 'function') { - notification.onAdd(_notification); + }, function(){ + if (typeof notification.onAdd === 'function') { + notification.onAdd(_notification); + } }); - + return _notification; },