From bf475f896bdd75ccab0f17f8496ff29fb96923dc Mon Sep 17 00:00:00 2001 From: Sean Future Date: Wed, 17 Aug 2016 15:53:39 -0400 Subject: [PATCH 1/2] Support for child controls --- MessageBar.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/MessageBar.js b/MessageBar.js index ad8e641..2979ce5 100644 --- a/MessageBar.js +++ b/MessageBar.js @@ -71,6 +71,7 @@ class MessageBar extends Component { /* Cusomisation of the alert: Title, Message, Icon URL, Alert alertType (error, success, warning, info), Duration for Alert keep shown */ title: props.title, message: props.message, + children: props.children, avatar: props.avatar, alertType: props.alertType || 'info', duration: props.duration || def.duration || 3000, @@ -186,7 +187,7 @@ class MessageBar extends Component { // If an alert is already shonw or doesn't have a title or a message, do nothing if ( this.alertShown || - (this.state.title == null && this.state.message == null) + (this.state.title == null && this.state.message == null && this.state.children == null) ) { return } @@ -518,8 +519,9 @@ class MessageBar extends Component { } renderMessage () { + var controls = []; if (this.state.message != null) { - return ( + controls.push( @@ -527,6 +529,12 @@ class MessageBar extends Component { ) } + if (this.state.children != null) { + controls.push( + this.state.children + ); + } + return controls; } } From 9a6b4490cc67002b56d9d9138ff8da80886459e1 Mon Sep 17 00:00:00 2001 From: Phillip Baker Date: Wed, 7 Mar 2018 17:50:32 -0500 Subject: [PATCH 2/2] Document children prop. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c6db04c..b03c3cf 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,7 @@ titleStyle | Style | { color: 'white', fontSize: 18, fontWeight: ' messageStyle | Style | { color: 'white', fontSize: 16 } | Style of the message position | String | top | Define the position of the alert, can be `top` or `right` animationType | String | SlideFromTop | Define the way the alert is animated on the view, can be `SlideFromTop`, `SlideFromBottom`, `SlideFromLeft` or `SlideFromRight`. If no value is specified, the animation type is selected for you based on the `position`; `SlideFromTop` if `position` is equal to `top`, `SlideFromBottom` if `position` is equal to `bottom`. The alert will then be smoothly displayed +children | Object | null | Children components to render beneath the message bar content ## Contributing