mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Apply page css when using nav-entry with create method
This commit is contained in:
2
tns-core-modules/ui/styling/style-scope.d.ts
vendored
2
tns-core-modules/ui/styling/style-scope.d.ts
vendored
@@ -22,7 +22,7 @@ export class StyleScope {
|
||||
|
||||
public static createSelectorsFromCss(css: string, cssFileName: string, keyframes: Object): RuleSet[];
|
||||
public static createSelectorsFromImports(tree: SyntaxTree, keyframes: Object): RuleSet[];
|
||||
public ensureSelectors(): boolean;
|
||||
public ensureSelectors(): number;
|
||||
|
||||
public applySelectors(view: ViewBase): void
|
||||
public query(options: Node): SelectorCore[];
|
||||
|
||||
@@ -200,7 +200,7 @@ export class StyleScope {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public ensureSelectors(): boolean {
|
||||
public ensureSelectors(): number {
|
||||
let toMerge: RuleSet[][];
|
||||
if (this._applicationCssSelectorsAppliedVersion !== applicationCssSelectorVersion ||
|
||||
this._localCssSelectorVersion !== this._localCssSelectorsAppliedVersion ||
|
||||
@@ -218,12 +218,10 @@ export class StyleScope {
|
||||
if (toMerge && toMerge.length > 0) {
|
||||
this._mergedCssSelectors = toMerge.filter(m => !!m).reduce((merged, next) => merged.concat(next), []);
|
||||
this._applyKeyframesOnSelectors();
|
||||
} else {
|
||||
return false;
|
||||
this._selectors = new SelectorsMap(this._mergedCssSelectors);
|
||||
}
|
||||
|
||||
this._selectors = new SelectorsMap(this._mergedCssSelectors);
|
||||
return true;
|
||||
return this._getSelectorsVersion();
|
||||
}
|
||||
|
||||
public applySelectors(view: ViewBase): void {
|
||||
@@ -245,6 +243,12 @@ export class StyleScope {
|
||||
this._viewIdToKey = {};
|
||||
}
|
||||
|
||||
private _getSelectorsVersion() {
|
||||
// The counters can only go up. So we can return just appVersion + localVersion
|
||||
// The 100000 * appVersion is just for easier debugging
|
||||
return 100000 * this._applicationCssSelectorsAppliedVersion + this._localCssSelectorsAppliedVersion;
|
||||
}
|
||||
|
||||
private _applyKeyframesOnSelectors() {
|
||||
for (let i = this._mergedCssSelectors.length - 1; i >= 0; i--) {
|
||||
let ruleset = this._mergedCssSelectors[i];
|
||||
|
||||
Reference in New Issue
Block a user