Skip to content

Commit 0b40f0a

Browse files
committed
- property 'avatarUrl' renamed to 'avatar' for clarity purpose. You can use a remote file using its URL, like avatar: 'http://urlToYourRemoteImage.extension', or a local file using avatar: require('<path/to/your/local/image.extension>')`
1 parent fc2e088 commit 0b40f0a

5 files changed

+10
-10
lines changed

AppTest.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class MessageBar extends Component {
7878
MessageBarManager.showAlert({
7979
title: "John Doe",
8080
message: "Hello, how are you?",
81-
avatarUrl: "https://image.freepik.com/free-icon/super-simple-avatar_318-1018.jpg",
81+
avatar: "https://image.freepik.com/free-icon/super-simple-avatar_318-1018.jpg",
8282
alertType: 'info',
8383
});
8484
}
@@ -88,7 +88,7 @@ class MessageBar extends Component {
8888
MessageBarManager.showAlert({
8989
title: "This is an alert with a callback function",
9090
message: "Tap on the alert to execute the callback you passed in parameter",
91-
avatarUrl: "http://www.icon100.com/up/4250/128/83-circle-error.png",
91+
avatar: "http://www.icon100.com/up/4250/128/83-circle-error.png",
9292
alertType: 'error',
9393
duration: 5000,
9494
onTapped: this.customCallback.bind(this),
@@ -147,7 +147,7 @@ class MessageBar extends Component {
147147
// /* Cusomisation of the alert: Title, Message, Icon URL, Alert Type (error, success, warning, info), Duration for Alert keep shown */
148148
// title={this.state.alertTitle} // Title of the alert
149149
// message={this.state.alertMessage} // Message of the alert
150-
// avatarUrl={this.state.alertIconUrl} // Avatar/Icon URL of the alert
150+
// avatar={this.state.alertIconUrl} // Avatar/Icon URL of the alert
151151
// type={this.state.alertType} // Alert Type: you can select one of 'success', 'error', 'warning', 'error', or 'custom' (use custom if you use a 5th stylesheet, all are customizable). Default is 'info'
152152
// duration={this.state.alertDuration} // Number of ms the alert is displayed. Default is 3000 ms (3 seconds)
153153
//

CustomChildComponent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CustomChildComponent extends Component {
3232
MessageBarManager.showAlert({
3333
title: 'Alert triggered from child component',
3434
message: "You can show an alert which is located on its parent's page. You can then declare only one MessageBar. This is useful to fix absolute position in child component",
35-
avatarUrl: null,
35+
avatar: null,
3636
alertType: 'success',
3737
});
3838
}

MessageBar.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MessageBar extends Component {
5959
/* Cusomisation of the alert: Title, Message, Icon URL, Alert alertType (error, success, warning, info), Duration for Alert keep shown */
6060
title: props.title,
6161
message: props.message,
62-
avatarUrl: props.avatarUrl,
62+
avatar: props.avatar,
6363
alertType: props.alertType || 'info',
6464
duration: props.duration || 3000,
6565

@@ -376,9 +376,9 @@ class MessageBar extends Component {
376376
}
377377

378378
renderImage() {
379-
if (this.state.avatarUrl != null) {
379+
if (this.state.avatar != null) {
380380
return (
381-
<Image source={{ uri: this.state.avatarUrl }} style={this.state.avatarStyle} />
381+
<Image source={{ uri: this.state.avatar }} style={this.state.avatarStyle} />
382382
);
383383
}
384384
}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ MessageBarManager.showAlert({
137137

138138
title: "John Doe", // Title of the alert
139139
message: "Hello, any suggestions?", // Message of the alert
140-
avatarUrl: "<URL of your icon/avatar>", // Avatar/Icon URL of the alert
140+
avatar: "<URL/require('<path>') of your icon/avatar>", // Avatar/Icon URL of the alert or enter require('LOCALPATH') for local image
141141

142142
/* Number of Lines for Title and Message */
143143
titleNumberOfLines: 1,
@@ -195,7 +195,7 @@ Prop | Type | Default | Description
195195
--------------------- | -------- | -------------------- | -----------
196196
title | String | | Title of the alert
197197
message | String | | Message of the alert
198-
avatarUrl | String | | Avatar/Icon URL of the alert
198+
avatar | String | | Avatar/Icon source/URL of the alert
199199
alertType | String | info | Alert Type: you can select one of 'success', 'error', 'warning', 'error', or 'custom' (use custom if you use a 5th stylesheet, all are customizable).
200200
duration | Number | 3000 | Number of ms the alert is displayed
201201
shouldHideAfterDelay | Bool | true | Tell the MessageBar whether or not it should hide after a delay defined in the `duration` property. If `false`, the MessageBar remain shown

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-message-bar",
3-
"version": "1.4.2",
3+
"version": "1.5.0",
44
"description": "A message bar alert displayed at the top of the screen for react-native",
55
"main": "index.js",
66
"private": false,

0 commit comments

Comments
 (0)