Skip to content

Commit 522cf7a

Browse files
author
Nedyalko Nikolov
authored
Merge pull request NativeScript#3444 from NativeScript/nnikolov/StyleScopeFix
Fixed style scope.
2 parents 35b0f24 + 08e73b3 commit 522cf7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tns-core-modules/ui/styling/style-scope.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ export function applyInlineStyle(view: ViewBase, style: string) {
264264
let inlineRuleSet = StyleScope.createSelectorsFromCss(localStyle, null, {});
265265
let inlineSelector = new InlineSelector(inlineRuleSet[0]);
266266
view.inlineStyleSelector = inlineSelector;
267-
view._cssState.apply();
267+
if (view._cssState) {
268+
view._cssState.apply();
269+
} else {
270+
let styleScope = new StyleScope();
271+
styleScope.applySelectors(view);
272+
}
268273
} catch (ex) {
269274
traceWrite("Applying local style failed: " + ex, traceCategories.Error, traceMessageType.error);
270275
}

0 commit comments

Comments
 (0)