Skip to content

Commit ef86add

Browse files
Hristo HristovHristo Hristov
Hristo Hristov
authored and
Hristo Hristov
committed
Fix Page to be styleScope if frame is not
1 parent 8a428b0 commit ef86add

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

tns-core-modules/ui/core/view/view-common.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
8080
return scope && scope.css;
8181
}
8282
set css(value: string) {
83-
this.updateStyleScope(undefined, undefined, value);
83+
this._updateStyleScope(undefined, undefined, value);
8484
}
8585

8686
public addCss(cssString: string): void {
87-
this.updateStyleScope(undefined, cssString);
87+
this._updateStyleScope(undefined, cssString);
8888
}
8989

9090
public addCssFile(cssFileName: string) {
91-
this.updateStyleScope(cssFileName);
91+
this._updateStyleScope(cssFileName);
9292
}
9393

94-
private updateStyleScope(cssFileName?: string, cssString?: string, css?: string): void {
94+
public _updateStyleScope(cssFileName?: string, cssString?: string, css?: string): void {
9595
let scope = this._styleScope;
9696
if (!scope) {
9797
scope = new StyleScope();
@@ -117,7 +117,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
117117
_setupAsRootView(context: any): void {
118118
super._setupAsRootView(context);
119119
if (!this._styleScope) {
120-
this.updateStyleScope();
120+
this._updateStyleScope();
121121
}
122122
}
123123

tns-core-modules/ui/core/view/view.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,14 @@ export abstract class View extends ViewBase {
658658
* @param cssFileName - A valid file name (from the application root) which contains a valid css.
659659
*/
660660
addCssFile(cssFileName: string): void;
661+
662+
/**
663+
* Updates styleScope or create new styleScope.
664+
* @param cssFileName
665+
* @param cssString
666+
* @param css
667+
*/
668+
_updateStyleScope(cssFileName?: string, cssString?: string, css?: string): void;
661669
//@endprivate
662670

663671
/**

tns-core-modules/ui/frame/frame.android.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,11 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
657657
page._setupUI(context);
658658
}
659659
} else {
660+
if (!this.frame._styleScope) {
661+
// Make sure page will have styleScope even if parents don't.
662+
page._updateStyleScope();
663+
}
664+
660665
this.frame._addView(page);
661666
}
662667

0 commit comments

Comments
 (0)