Skip to content

Commit

Permalink
Support for child controls
Browse files Browse the repository at this point in the history
  • Loading branch information
seanfuture authored and phillbaker committed Mar 8, 2018
1 parent 9a79a37 commit bf475f8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions MessageBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -518,15 +519,22 @@ class MessageBar extends Component {
}

renderMessage () {
var controls = [];
if (this.state.message != null) {
return (
controls.push(
<Text
numberOfLines={this.state.messageNumberOfLines}
style={[this.state.messageStyle, {color: this.state.messageColor}]}>
{this.state.message}
</Text>
)
}
if (this.state.children != null) {
controls.push(
this.state.children
);
}
return controls;
}
}

Expand Down

0 comments on commit bf475f8

Please sign in to comment.