mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
FIX: Don't apply css on unloaded
This commit is contained in:
@ -647,8 +647,7 @@ export class View extends ProxyObject implements definition.View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onUnloaded() {
|
public onUnloaded() {
|
||||||
this._onCssStateChange(this._cssState, null);
|
this._setCssState(null);
|
||||||
this._cssState = null;
|
|
||||||
|
|
||||||
this._unloadEachChildView();
|
this._unloadEachChildView();
|
||||||
|
|
||||||
@ -1180,8 +1179,7 @@ export class View extends ProxyObject implements definition.View {
|
|||||||
if (!view) {
|
if (!view) {
|
||||||
throw new Error("Expecting a valid View instance.");
|
throw new Error("Expecting a valid View instance.");
|
||||||
}
|
}
|
||||||
if(!(view instanceof View))
|
if (!(view instanceof View)) {
|
||||||
{
|
|
||||||
throw new Error(view + " is not a valid View instance.");
|
throw new Error(view + " is not a valid View instance.");
|
||||||
}
|
}
|
||||||
if (view._parent) {
|
if (view._parent) {
|
||||||
@ -1439,7 +1437,9 @@ export class View extends ProxyObject implements definition.View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make sure the state is set to null and this is called on unloaded to clean up change listeners...
|
// TODO: Make sure the state is set to null and this is called on unloaded to clean up change listeners...
|
||||||
_onCssStateChange(previous: CssState, next: CssState): void {
|
_setCssState(next: CssState): void {
|
||||||
|
const previous = this._cssState;
|
||||||
|
this._cssState = next;
|
||||||
|
|
||||||
if (!this._invalidateCssHandler) {
|
if (!this._invalidateCssHandler) {
|
||||||
this._invalidateCssHandler = () => {
|
this._invalidateCssHandler = () => {
|
||||||
|
2
tns-core-modules/ui/core/view.d.ts
vendored
2
tns-core-modules/ui/core/view.d.ts
vendored
@ -605,7 +605,7 @@ declare module "ui/core/view" {
|
|||||||
_domId: number;
|
_domId: number;
|
||||||
|
|
||||||
_cssState: any /* "ui/styling/style-scope" */;
|
_cssState: any /* "ui/styling/style-scope" */;
|
||||||
_onCssStateChange(previous: any /* "ui/styling/style-scope" */, any /* "ui/styling/style-scope" */);
|
_setCssState(next: any /* "ui/styling/style-scope" */);
|
||||||
|
|
||||||
_registerAnimation(animation: keyframeAnimationModule.KeyframeAnimation);
|
_registerAnimation(animation: keyframeAnimationModule.KeyframeAnimation);
|
||||||
_unregisterAnimation(animation: keyframeAnimationModule.KeyframeAnimation);
|
_unregisterAnimation(animation: keyframeAnimationModule.KeyframeAnimation);
|
||||||
|
@ -201,10 +201,8 @@ export class StyleScope {
|
|||||||
|
|
||||||
let state = this._selectors.query(view);
|
let state = this._selectors.query(view);
|
||||||
|
|
||||||
let previousState = view._cssState;
|
|
||||||
let nextState = new CssState(view, state);
|
let nextState = new CssState(view, state);
|
||||||
view._cssState = nextState;
|
view._setCssState(nextState);
|
||||||
view._onCssStateChange(previousState, nextState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public query(node: Node): SelectorCore[] {
|
public query(node: Node): SelectorCore[] {
|
||||||
|
Reference in New Issue
Block a user