@@ -223,36 +223,6 @@ export default class ReactNotification extends React.Component {
223223 }
224224 }
225225
226- renderTitle ( ) {
227- const { notification : { title } } = this . props ;
228- if ( ! title ) return null ;
229- return (
230- < p className = 'notification-title' >
231- { title }
232- </ p >
233- ) ;
234- }
235-
236- renderMessage ( ) {
237- const { notification : { message } } = this . props ;
238- return (
239- < p className = 'notification-message' >
240- { message }
241- </ p >
242- ) ;
243- }
244-
245- renderCloseIcon ( ) {
246- const { notification : { dismiss : { showIcon } } } = this . props ;
247- if ( ! showIcon ) return null ;
248- return (
249- < div
250- className = 'notification-close'
251- onClick = { this . onClick }
252- > </ div >
253- ) ;
254- }
255-
256226 renderTimer ( ) {
257227 const { notification : { dismiss } } = this . props ;
258228 const { duration, onScreen } = dismiss ;
@@ -284,8 +254,8 @@ export default class ReactNotification extends React.Component {
284254 }
285255
286256 renderCustomContent ( ) {
287- const { htmlClassList } = this . state ;
288- const { notification : { content : CustomContent } } = this . props ;
257+ const { htmlClassList, animationPlayState } = this . state ;
258+ const { notification : { id , content : CustomContent } } = this . props ;
289259
290260 return (
291261 < div
@@ -294,15 +264,25 @@ export default class ReactNotification extends React.Component {
294264 {
295265 React . isValidElement ( CustomContent )
296266 ? CustomContent
297- : < CustomContent />
267+ : < CustomContent { ... { id , animationPlayState } } />
298268 }
299269 </ div >
300270 ) ;
301271 }
302272
303273 renderNotification ( ) {
274+ const {
275+ notification : {
276+ title,
277+ message,
278+ dismiss : {
279+ showIcon,
280+ duration,
281+ pauseOnHover
282+ }
283+ }
284+ } = this . props ;
304285 const { htmlClassList } = this . state ;
305- const { notification : { dismiss : { duration, pauseOnHover } } } = this . props ;
306286 const hasMouseEvents = duration > 0 && pauseOnHover ;
307287
308288 return (
@@ -312,9 +292,9 @@ export default class ReactNotification extends React.Component {
312292 onMouseLeave = { hasMouseEvents ? this . onMouseLeave : null }
313293 >
314294 < div className = 'notification-content' >
315- { this . renderCloseIcon ( ) }
316- { this . renderTitle ( ) }
317- { this . renderMessage ( ) }
295+ { showIcon && < div className = 'notification-close' onClick = { this . onClick } > </ div > }
296+ { title && < p className = 'notification-title' > { title } </ p > }
297+ { < p className = 'notification-message' > { message } </ p > }
318298 { this . renderTimer ( ) }
319299 </ div >
320300 </ div >
0 commit comments