Skip to content

Commit eaaf806

Browse files
committed
added logs to inform devs of invalid props
1 parent ff692d5 commit eaaf806

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

demo/app/main-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
row="1"
1515
icon="res://ic_add_white"
1616
tap="fabTap"
17-
rippleColor="blue"
17+
rippleColor="#ffffff"
1818
class="fab-button" />
1919
</grid-layout>
2020
</Page>

demo/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
{
2-
"nativescript": {
3-
"id": "org.nativescript.floatingactionbutton",
4-
"tns-android": {
5-
"version": "1.6.0"
6-
},
7-
"tns-ios": {
8-
"version": "1.6.0"
9-
}
10-
},
11-
"dependencies": {
12-
"nativescript-floatingactionbutton": "file:..",
13-
"tns-core-modules": "latest"
14-
}
1+
{
2+
"nativescript": {
3+
"id": "org.nativescript.floatingactionbutton",
4+
"tns-android": {
5+
"version": "1.6.1"
6+
},
7+
"tns-ios": {
8+
"version": "1.6.0"
9+
}
10+
},
11+
"dependencies": {
12+
"nativescript-floatingactionbutton": "file:..",
13+
"tns-core-modules": "latest"
14+
}
1515
}

fab.android.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,20 @@ function onIconPropertyChanged(data) {
101101

102102
if(ImageSource.isFileOrResourcePath(icon)){
103103
iconDrawable = ImageSource.fromFileOrResource(icon);
104-
fab.android.setImageBitmap(iconDrawable.android);
105-
}
106-
else{
104+
if (iconDrawable) {
105+
fab.android.setImageBitmap(iconDrawable.android);
106+
} else {
107+
console.log("The icon: " + icon + " was not found. Check your XML icon property.");
108+
}
109+
} else {
107110
var drawableId = android.content.res.Resources.getSystem().getIdentifier(icon, "drawable", "android");
108-
iconDrawable = android.content.res.Resources.getSystem().getDrawable(drawableId);
109-
fab.android.setImageDrawable(iconDrawable);
110-
}
111+
iconDrawable = android.content.res.Resources.getSystem().getDrawable(drawableId);
112+
if (iconDrawabele) {
113+
fab.android.setImageDrawable(iconDrawable);
114+
} else {
115+
console.log("The icon: " + icon + " was not found. Check your XML icon property.");
116+
}
117+
}
111118
}
112119
common.Fab.iconProperty.metadata.onSetNativeValue = onIconPropertyChanged;
113120

@@ -117,6 +124,8 @@ function onRippleColorPropertyChanged(data) {
117124
var fab = data.object;
118125
var droidColor = new color.Color(data.newValue).android;
119126
fab.android.setRippleColor(droidColor);
127+
} else {
128+
console.log("The ripple color: " + data.newValue + " is invalid.");
120129
}
121130
}
122131
common.Fab.rippleColorProperty.metadata.onSetNativeValue = onRippleColorPropertyChanged;

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-floatingactionbutton",
3-
"version": "0.2.01",
3+
"version": "0.2.2",
44
"description": "A NativeScript plugin to provide an XML widget to implement the Material Design Floating Action Button in NativeScript apps.",
55
"main": "fab.js",
66
"nativescript": {
@@ -37,8 +37,5 @@
3737
],
3838
"license": "Apache-2.0",
3939
"bugs": "https://github.com/bradmartin/nativescript-floatingactionbutton/issues",
40-
"homepage": "https://github.com/bradmartin/nativescript-floatingactionbutton",
41-
"dependencies": {
42-
"tns-core-modules": "^1.6.0"
43-
}
40+
"homepage": "https://github.com/bradmartin/nativescript-floatingactionbutton"
4441
}

0 commit comments

Comments
 (0)