4
4
* https://twitter.com/BradWayneMartin
5
5
* https://github.com/bradmartin
6
6
* Pull requests are welcome. Enjoy!
7
+ * Cocoapod via: https://cocoapods.org/pods/KCFloatingActionButton by Lee Sun-hyoup
7
8
*************************************************************************************/
8
9
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" ) ;
11
13
var style = require ( "ui/styling/style" ) ;
14
+ var utils = require ( "utils/utils" ) ;
15
+ var enums = require ( "ui/enums" ) ;
12
16
13
17
require ( "utils/module-merge" ) . merge ( common , module . exports ) ;
14
18
@@ -18,47 +22,59 @@ var FloatingActionButton = (function (_super) {
18
22
function FloatingActionButton ( ) {
19
23
var _this = this ;
20
24
_super . call ( this ) ;
21
- var size = CGRectMake ( 0 , 0 , 50 , 50 ) ;
22
- this . _ios = MNFloatingActionButton . alloc ( ) . initWithFrame ( size ) ;
23
25
26
+ var button = KCFloatingActionButton . alloc ( ) . init ( ) ;
27
+ this . _ios = button ;
24
28
}
25
29
26
30
Object . defineProperty ( FloatingActionButton . prototype , "ios" , {
27
31
get : function ( ) {
28
32
return this . _ios ;
29
33
}
30
34
} ) ;
31
-
35
+
32
36
return FloatingActionButton ;
33
37
34
38
} ) ( common . Fab ) ;
35
39
36
40
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
- }
53
41
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 ( ) ;
0 commit comments