Skip to content

Commit 662c122

Browse files
joshcomleyMartoYankov
authored andcommitted
Support for adding scoped CSS without triggering global refresh (#1999)
* Scoped styles should not trigger a global refresh (for bug: NativeScript/theme#179) * Update nativescript-angular/renderer.ts Fixed profiling naming inconsistencies Co-Authored-By: Martin Yankov <[email protected]> * Update nativescript-angular/renderer.ts Naming consistency fix Co-Authored-By: Martin Yankov <[email protected]>
1 parent 787dd62 commit 662c122

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: nativescript-angular/renderer.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ class EmulatedRenderer extends NativeScriptRenderer {
356356
private addStyles(styles: (string | any[])[], componentId: string) {
357357
styles.map(s => s.toString())
358358
.map(s => replaceNgAttribute(s, componentId))
359-
.forEach(addStyleToCss);
359+
.forEach(addScopedStyleToCss);
360360
}
361361
}
362362

@@ -365,6 +365,11 @@ const addStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss
365365
addCss(style);
366366
});
367367

368+
// tslint:disable-next-line
369+
const addScopedStyleToCss = profile('"renderer".addScopedStyleToCss', function addScopedStyleToCss(style: string): void {
370+
addCss(style, true);
371+
});
372+
368373
function replaceNgAttribute(input: string, componentId: string): string {
369374
return input.replace(COMPONENT_REGEX, componentId);
370375
}

0 commit comments

Comments
 (0)