diff --git a/apps/app/ui-tests-app/flexbox/flexbox.ts b/apps/app/ui-tests-app/flexbox/flexbox.ts index 4f8f8884d..f3de4f096 100644 --- a/apps/app/ui-tests-app/flexbox/flexbox.ts +++ b/apps/app/ui-tests-app/flexbox/flexbox.ts @@ -2,11 +2,8 @@ import { FlexboxLayout } from "ui/layouts/flexbox-layout"; function set(what: string) { return function(args) { - // args.object.page.getViewById("container")[what] = args.object.text; let containerCss = " #container { " + args.object.tag + " }" ; - // console.log(containerCss); args.object.page.addCss(containerCss); - // console.log(args.object.page.css); } } diff --git a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts index 23ca718c2..5e66cdb8f 100644 --- a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts +++ b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout-common.ts @@ -392,16 +392,3 @@ const flexProperty = new ShorthandProperty({ } }) flexProperty.register(Style); - -Style.prototype.flexDirection = flexDirectionProperty.defaultValue; -Style.prototype.flexWrap = flexWrapProperty.defaultValue; -Style.prototype.justifyContent = justifyContentProperty.defaultValue; -Style.prototype.alignItems = alignItemsProperty.defaultValue; -Style.prototype.alignContent = alignContentProperty.defaultValue; -Style.prototype.order = orderProperty.defaultValue; -Style.prototype.flexGrow = flexGrowProperty.defaultValue; -Style.prototype.flexShrink = flexShrinkProperty.defaultValue; -Style.prototype.flexWrapBefore = flexWrapBeforeProperty.defaultValue; -Style.prototype.alignSelf = alignSelfProperty.defaultValue; - -// No flex-basis in our implementation. diff --git a/tns-core-modules/ui/styling/style-scope.ts b/tns-core-modules/ui/styling/style-scope.ts index 1666861a5..8d2aa4f1e 100644 --- a/tns-core-modules/ui/styling/style-scope.ts +++ b/tns-core-modules/ui/styling/style-scope.ts @@ -135,7 +135,7 @@ export class StyleScope { private _statesByKey = {}; private _viewIdToKey = {}; - private _css: string; + private _css: string = ""; private _cssFileName: string; private _mergedCssSelectors: RuleSet[]; private _localCssSelectors: RuleSet[] = []; @@ -154,25 +154,26 @@ export class StyleScope { } public addCss(cssString: string, cssFileName?: string): void { - this.setCss(cssString, cssFileName, true); + this.appendCss(cssString, cssFileName) } - private setCss(cssString: string, cssFileName?: string, append: boolean = false): void { - this._css = this._css && append ? this._css + cssString : cssString; - if (cssFileName) { - this._cssFileName = cssFileName; - } - + private setCss(cssString: string, cssFileName?): void { + this._css = cssString; this._reset(); + this._localCssSelectors = createSelectorsFromCss(this._css, cssFileName, this._keyframes); + this._localCssSelectorVersion++; + this.ensureSelectors(); + } - const parsedSelectors = createSelectorsFromCss(this._css, cssFileName, this._keyframes); - - if (append) { - this._localCssSelectors.push.apply(this._localCssSelectors, parsedSelectors); - } else { - this._localCssSelectors = parsedSelectors; + private appendCss(cssString: string, cssFileName?): void { + if (!cssString) { + return; } + this._css = this._css + cssString; + this._reset(); + let parsedCssSelectors = createSelectorsFromCss(cssString, cssFileName, this._keyframes); + this._localCssSelectors.push.apply(this._localCssSelectors, parsedCssSelectors); this._localCssSelectorVersion++; this.ensureSelectors(); }