mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Avoid applying CSS multiple times (#4784)
* Move the applyStyleFromScope to onLoaded, when the views are created and id or className properties are set the CSS selectors are queried and applied multiple times * Condense the changes when applying properties
This commit is contained in:
committed by
SvetoslavTsenov
parent
b0577728be
commit
6d7c1ff295
@@ -281,28 +281,15 @@ export class GridLayoutBase extends LayoutBase implements GridLayoutDefinition {
|
||||
this.requestLayout();
|
||||
}
|
||||
|
||||
_applyXmlAttribute(attributeName: string, attributeValue: any): boolean {
|
||||
if (attributeName === "columns") {
|
||||
this._setColumns(attributeValue);
|
||||
return true;
|
||||
}
|
||||
else if (attributeName === "rows") {
|
||||
this._setRows(attributeValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super._applyXmlAttribute(attributeName, attributeValue);
|
||||
}
|
||||
|
||||
private _setColumns(value: string) {
|
||||
this.removeColumns();
|
||||
parseAndAddItemSpecs(value, (spec: ItemSpec) => this.addColumn(spec));
|
||||
}
|
||||
|
||||
private _setRows(value: string) {
|
||||
set rows(value: string) {
|
||||
this.removeRows();
|
||||
parseAndAddItemSpecs(value, (spec: ItemSpec) => this.addRow(spec));
|
||||
}
|
||||
|
||||
set columns(value: string) {
|
||||
this.removeColumns();
|
||||
parseAndAddItemSpecs(value, (spec: ItemSpec) => this.addColumn(spec));
|
||||
}
|
||||
}
|
||||
|
||||
GridLayoutBase.prototype.recycleNativeView = "auto";
|
||||
|
||||
Reference in New Issue
Block a user