File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NamespaceFilter } from './property-filter';
55
66import { NativeScriptDebug } from './trace' ;
77import { NgLayoutBase } from './views/view-types' ;
8+ import { isCssVariable } from '@nativescript/core/ui/core/properties' ;
89
910const ELEMENT_NODE_TYPE = 1 ;
1011const XML_ATTRIBUTES = Object . freeze ( [ 'style' , 'rows' , 'columns' , 'fontAttributes' ] ) ;
@@ -497,10 +498,21 @@ export class ViewUtil {
497498 }
498499
499500 public setStyle ( view : View , styleName : string , value : any ) {
500- view . style [ styleName ] = value ;
501+ if ( isCssVariable ( styleName ) ) {
502+ view . style . setUnscopedCssVariable ( styleName , value ) ;
503+ view . _onCssStateChange ( ) ;
504+ } else {
505+ view . style [ styleName ] = value ;
506+ }
501507 }
502508
503509 public removeStyle ( view : View , styleName : string ) {
504- view . style [ styleName ] = unsetValue ;
510+ if ( isCssVariable ( styleName ) ) {
511+ // TODO: expose this on core
512+ ( view . style as any ) . unscopedCssVariables . delete ( styleName ) ;
513+ view . _onCssStateChange ( ) ;
514+ } else {
515+ view . style [ styleName ] = unsetValue ;
516+ }
505517 }
506518}
You can’t perform that action at this time.
0 commit comments