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';
5
5
6
6
import { NativeScriptDebug } from './trace' ;
7
7
import { NgLayoutBase } from './views/view-types' ;
8
+ import { isCssVariable } from '@nativescript/core/ui/core/properties' ;
8
9
9
10
const ELEMENT_NODE_TYPE = 1 ;
10
11
const XML_ATTRIBUTES = Object . freeze ( [ 'style' , 'rows' , 'columns' , 'fontAttributes' ] ) ;
@@ -497,10 +498,21 @@ export class ViewUtil {
497
498
}
498
499
499
500
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
+ }
501
507
}
502
508
503
509
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
+ }
505
517
}
506
518
}
You can’t perform that action at this time.
0 commit comments