Skip to content

Commit afafbd7

Browse files
Updates, Changed POD
1 parent 9dab99b commit afafbd7

File tree

6 files changed

+63
-89
lines changed

6 files changed

+63
-89
lines changed

demo/app/app.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ button {
1616
}
1717

1818
.fab-button {
19-
height: 70;
19+
height: 50;
20+
width: 50;
2021
margin: 15;
2122
horizontal-align: right;
2223
vertical-align: bottom;
23-
color: red;
24+
color: #FFF;
25+
background-color: #ff4081;
2426
}

demo/app/main-page.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ var users = [
1111
{ name: 'Lance' },
1212
{ name: 'Johnson' },
1313
{ name: 'William' },
14-
{ name: 'Franklin' },
15-
{ name: 'Napoleon' },
14+
{ name: 'Franklin' }
1615
];
1716
var viewModel = new observable.Observable({
1817
users: users
@@ -28,9 +27,9 @@ function pageLoaded(args) {
2827
}
2928
}
3029
page.bindingContext = viewModel;
31-
32-
var button = page.getViewById("fabButton");
33-
debugger;
34-
page.ios.view.addSubview(button.ios);
3530
}
36-
exports.pageLoaded = pageLoaded;
31+
exports.pageLoaded = pageLoaded;
32+
33+
exports.fabTap = function(args){
34+
alert("FAB TAP")
35+
}

demo/app/main-page.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
<grid-layout rows="auto, *">
77
<list-view row="1" items="{{ users }}">
88
<list-view.itemTemplate>
9-
<label text="{{ name }}" textWrap="true" fontSize="18" margin="20" />
9+
<label text="{{ name }}" textWrap="true" fontSize="15" margin="20" />
1010
</list-view.itemTemplate>
1111
</list-view>
1212
<FAB:fab
1313
id="fabButton"
14+
row="1"
15+
icon="res://ic_add_white"
16+
tap="fabTap"
1417
class="fab-button" />
15-
1618
</grid-layout>
1719
</Page>

fab.ios.js

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
* https://twitter.com/BradWayneMartin
55
* https://github.com/bradmartin
66
* Pull requests are welcome. Enjoy!
7+
* Cocoapod via: https://cocoapods.org/pods/KCFloatingActionButton by Lee Sun-hyoup
78
*************************************************************************************/
89

9-
var common = require("./fab-common");
10-
var ImageSource = require("image-source");
10+
var common = require("./fab-common");
11+
var ImageSource = require("image-source");
12+
var stateChanged = require("ui/core/control-state-change");
1113
var style = require("ui/styling/style");
14+
var utils = require("utils/utils");
15+
var enums = require("ui/enums");
1216

1317
require("utils/module-merge").merge(common, module.exports);
1418

@@ -18,47 +22,59 @@ var FloatingActionButton = (function (_super) {
1822
function FloatingActionButton() {
1923
var _this = this;
2024
_super.call(this);
21-
var size = CGRectMake(0, 0, 50, 50);
22-
this._ios = MNFloatingActionButton.alloc().initWithFrame(size);
2325

26+
var button = KCFloatingActionButton.alloc().init();
27+
this._ios = button;
2428
}
2529

2630
Object.defineProperty(FloatingActionButton.prototype, "ios", {
2731
get: function () {
2832
return this._ios;
2933
}
3034
});
31-
35+
3236
return FloatingActionButton;
3337

3438
})(common.Fab);
3539

3640
exports.Fab = FloatingActionButton;
37-
38-
// this function is called when the `color` Style property changes on a `NumberPicker` instance
39-
function setColor(view, value) {
40-
var fab = view.ios;
41-
42-
// value is UIColor, so we may apply it directly
43-
fab.backgroundColor = value;
44-
}
45-
46-
// this function is called when the `color` Style property changes and the new value is `undefined`
47-
function resetColor(view, value) {
48-
var fab = view.ios;
49-
50-
// value is native UIColor, so apply it directly
51-
fab.backgroundColor = value;
52-
}
5341

54-
// this function is called when the `Styler` is about to reset the `color` property to its default (original) value.
55-
function getNativeColorValue(view) {
56-
var fab = view.ios;
57-
58-
return fab.backgroundColor;
59-
}
60-
debugger;
61-
var changedHandler = new style.StylePropertyChangedHandler(setColor, resetColor, getNativeColorValue);
62-
63-
// register the handler for the color property on the NumberPicker type
64-
style.registerHandler(style.properties.colorProperty, changedHandler, "FloatingActionButton");
42+
var FloatingActionButtonStyler = (function () {
43+
function FloatingActionButtonStyler() {
44+
}
45+
// COLOR
46+
FloatingActionButtonStyler.setColorProperty = function (view, newValue) {
47+
var fab = view.ios;
48+
fab.plusColor = newValue;
49+
};
50+
FloatingActionButtonStyler.resetColorProperty = function (view, nativeValue) {
51+
var fab = view.ios;
52+
fab.plusColor = nativeValue;
53+
};
54+
FloatingActionButtonStyler.getNativeColorValue = function (view) {
55+
var fab = view.ios;
56+
return fab.plusColor;
57+
};
58+
59+
// BACKGROUND COLOR
60+
FloatingActionButtonStyler.setBackgroundColorProperty = function (view, newValue) {
61+
var fab = view.ios;
62+
fab.buttonColor = newValue;
63+
};
64+
FloatingActionButtonStyler.resetBackgroundColorProperty = function (view, nativeValue) {
65+
var fab = view.ios;
66+
fab.buttonColor = nativeValue;
67+
};
68+
FloatingActionButtonStyler.getNativeBackgroundColorValue = function (view) {
69+
var fab = view.ios;
70+
return fab.buttonColor;
71+
};
72+
73+
FloatingActionButtonStyler.registerHandlers = function () {
74+
style.registerHandler(style.colorProperty, new style.StylePropertyChangedHandler(FloatingActionButtonStyler.setColorProperty, FloatingActionButtonStyler.resetColorProperty, FloatingActionButtonStyler.getNativeColorValue), "FloatingActionButton");
75+
style.registerHandler(style.backgroundColorProperty, new style.StylePropertyChangedHandler(FloatingActionButtonStyler.setBackgroundColorProperty, FloatingActionButtonStyler.resetBackgroundColorProperty, FloatingActionButtonStyler.getNativeBackgroundColorValue), "FloatingActionButton");
76+
};
77+
return FloatingActionButtonStyler;
78+
})();
79+
exports.FloatingActionButtonStyler = FloatingActionButtonStyler;
80+
FloatingActionButtonStyler.registerHandlers();

platforms/ios/PodFile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pod 'MNFloatingActionButton'
1+
pod 'KCFloatingActionButton'

platforms/ios/nativescriptfloatingactionbutton/app/App_Resources/iOS/Info.plist

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)