From a6833f61ac2ff8c6a8da714749cff290c2498e85 Mon Sep 17 00:00:00 2001 From: Josh Comley Date: Sat, 5 Oct 2019 16:09:04 +0100 Subject: [PATCH 1/3] Scoped styles should not trigger a global refresh (for bug: https://github.com/NativeScript/theme/issues/179) --- nativescript-angular/renderer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index aadc69a1a..e25112647 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -356,7 +356,7 @@ class EmulatedRenderer extends NativeScriptRenderer { private addStyles(styles: (string | any[])[], componentId: string) { styles.map(s => s.toString()) .map(s => replaceNgAttribute(s, componentId)) - .forEach(addStyleToCss); + .forEach(addScopedStyleToCss); } } @@ -365,6 +365,11 @@ const addStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss addCss(style); }); +// tslint:disable-next-line +const addScopedStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss(style: string): void { + addCss(style, true); +}); + function replaceNgAttribute(input: string, componentId: string): string { return input.replace(COMPONENT_REGEX, componentId); } From 38761eb69181e370fae0306e596fe14936371a6f Mon Sep 17 00:00:00 2001 From: joshcomley Date: Tue, 8 Oct 2019 10:25:14 +0100 Subject: [PATCH 2/3] Update nativescript-angular/renderer.ts Fixed profiling naming inconsistencies Co-Authored-By: Martin Yankov --- nativescript-angular/renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index e25112647..99db07948 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -366,7 +366,7 @@ const addStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss }); // tslint:disable-next-line -const addScopedStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss(style: string): void { +const addScopedStyleToCss = profile('"renderer".addStyleToCss', function addScopedStyleToCss(style: string): void { addCss(style, true); }); From 91b480b644b59a6a952d123dba3f1a2d36294952 Mon Sep 17 00:00:00 2001 From: joshcomley Date: Tue, 8 Oct 2019 13:06:03 +0100 Subject: [PATCH 3/3] Update nativescript-angular/renderer.ts Naming consistency fix Co-Authored-By: Martin Yankov --- nativescript-angular/renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index 99db07948..51d54edc1 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -366,7 +366,7 @@ const addStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss }); // tslint:disable-next-line -const addScopedStyleToCss = profile('"renderer".addStyleToCss', function addScopedStyleToCss(style: string): void { +const addScopedStyleToCss = profile('"renderer".addScopedStyleToCss', function addScopedStyleToCss(style: string): void { addCss(style, true); });