Skip to content

Commit

Permalink
Merge KBLNY#30
Browse files Browse the repository at this point in the history
  • Loading branch information
Talor-A authored Mar 28, 2018
2 parents 9a79a37 + 9a6b449 commit 756b76d
Show file tree
Hide file tree
Showing 2 changed files with 11 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 756b76d

Please sign in to comment.