From 308fa55e02aad41f5536001c62365617594e24d2 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Tue, 14 Mar 2017 15:34:03 +0200 Subject: [PATCH] Fix disappearing list item styles when navigating back to a page. Do not clear style scope on unload event. Do it when removing child views instead. --- tns-core-modules/ui/core/view-base/view-base.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/ui/core/view-base/view-base.ts b/tns-core-modules/ui/core/view-base/view-base.ts index 33d355257..4c1abb644 100644 --- a/tns-core-modules/ui/core/view-base/view-base.ts +++ b/tns-core-modules/ui/core/view-base/view-base.ts @@ -240,8 +240,6 @@ export class ViewBase extends Observable implements ViewBaseDefinition { } public onUnloaded() { - this._styleScope = null; - this._setCssState(null); this._unloadEachChild(); this._isLoaded = false; this._emit("unloaded"); @@ -261,6 +259,8 @@ export class ViewBase extends Observable implements ViewBaseDefinition { const scope = this._styleScope; if (scope) { scope.applySelectors(this); + } else { + this._setCssState(null); } } @@ -540,6 +540,9 @@ export class ViewBase extends Observable implements ViewBaseDefinition { */ public _removeViewCore(view: ViewBase) { // TODO: Discuss this. + if (this._styleScope === view._styleScope) { + view._setStyleScope(null); + } if (view.isLoaded) { view.onUnloaded(); }