@@ -16,6 +16,14 @@ interface TextUIView {
1616 textColor : UIColor ;
1717}
1818
19+ var ignorePropertyHandler = new stylersCommon . StylePropertyChangedHandler (
20+ ( view , val ) => {
21+ // empty
22+ } ,
23+ ( view , val ) => {
24+ // empty
25+ } ) ;
26+
1927export class DefaultStyler implements definition . stylers . Styler {
2028 //Background methods
2129 private static setBackgroundInternalProperty ( view : view . View , newValue : any ) {
@@ -537,13 +545,13 @@ export class SwitchStyler implements definition.stylers.Styler {
537545 SwitchStyler . resetColorProperty ,
538546 SwitchStyler . getNativeColorValue ) , "Switch" ) ;
539547
540- var bkgHandler = new stylersCommon . StylePropertyChangedHandler (
548+ style . registerHandler ( style . backgroundColorProperty , new stylersCommon . StylePropertyChangedHandler (
541549 SwitchStyler . setBackgroundColorProperty ,
542550 SwitchStyler . resetBackgroundColorProperty ,
543- SwitchStyler . getBackgroundColorProperty ) ;
551+ SwitchStyler . getBackgroundColorProperty ) , "Switch" ) ;
544552
545- style . registerHandler ( style . backgroundColorProperty , bkgHandler , "Switch" ) ;
546- style . registerHandler ( style . backgroundInternalProperty , bkgHandler , "Switch" ) ;
553+ // Ignore the default backgroundInternalProperty handler
554+ style . registerHandler ( style . backgroundInternalProperty , ignorePropertyHandler , "Switch" ) ;
547555 }
548556}
549557
@@ -634,23 +642,48 @@ export class ActionBarStyler implements definition.stylers.Styler {
634642 private static setColorProperty ( view : view . View , newValue : any ) {
635643 var topFrame = frame . topmost ( ) ;
636644 if ( topFrame ) {
637- var bar = topFrame . ios . controller . navigationBar ;
638- ( < any > bar ) . titleTextAttributes = { [ NSForegroundColorAttributeName ] : newValue } ;
645+ var navBar = topFrame . ios . controller . navigationBar ;
646+ navBar . titleTextAttributes = < any > { [ NSForegroundColorAttributeName ] : newValue } ;
647+ navBar . tintColor = newValue ;
639648 }
640649 }
641650
642651 private static resetColorProperty ( view : view . View , nativeValue : any ) {
643652 var topFrame = frame . topmost ( ) ;
644653 if ( topFrame ) {
645- var bar = topFrame . ios . controller . navigationBar ;
646- ( < any > bar ) . titleTextAttributes = null ;
654+ var navBar = topFrame . ios . controller . navigationBar ;
655+ navBar . titleTextAttributes = null ;
656+ navBar . tintColor = null ;
657+ }
658+ }
659+
660+ // background-color
661+ private static setBackgroundColorProperty ( view : view . View , newValue : any ) {
662+ var topFrame = frame . topmost ( ) ;
663+ if ( topFrame ) {
664+ var navBar = topFrame . ios . controller . navigationBar ;
665+ navBar . barTintColor = newValue ;
666+ }
667+ }
668+
669+ private static resetBackgroundColorProperty ( view : view . View , nativeValue : any ) {
670+ var topFrame = frame . topmost ( ) ;
671+ if ( topFrame ) {
672+ var navBar = topFrame . ios . controller . navigationBar ;
673+ navBar . barTintColor = null ;
647674 }
648675 }
649676
650677 public static registerHandlers ( ) {
651678 style . registerHandler ( style . colorProperty , new stylersCommon . StylePropertyChangedHandler (
652679 ActionBarStyler . setColorProperty ,
653680 ActionBarStyler . resetColorProperty ) , "ActionBar" ) ;
681+
682+ style . registerHandler ( style . backgroundColorProperty , new stylersCommon . StylePropertyChangedHandler (
683+ ActionBarStyler . setBackgroundColorProperty ,
684+ ActionBarStyler . resetBackgroundColorProperty ) , "ActionBar" ) ;
685+
686+ style . registerHandler ( style . backgroundInternalProperty , ignorePropertyHandler , "ActionBar" ) ;
654687 }
655688}
656689
0 commit comments