fix layer type recycling (#4574)

This commit is contained in:
Hristo Hristov
2017-07-19 15:39:07 +03:00
committed by GitHub
parent 74f26f4498
commit a17cd1169c

View File

@ -1,6 +1,7 @@
// Definitions. // Definitions.
import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from "."; import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from ".";
import { GestureTypes, GestureEventData } from "../../gestures"; import { GestureTypes, GestureEventData } from "../../gestures";
import { CacheLayerType } from "../../../utils/utils";
// Types. // Types.
import { Background, ad as androidBackground } from "../../styling/background"; import { Background, ad as androidBackground } from "../../styling/background";
@ -17,12 +18,13 @@ import {
rotateProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, rotateProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty,
zIndexProperty, backgroundInternalProperty zIndexProperty, backgroundInternalProperty
} from "../../styling/style-properties"; } from "../../styling/style-properties";
import { profile } from "../../../profiling"; import { profile } from "../../../profiling";
export * from "./view-common"; export * from "./view-common";
interface TouchListener { interface TouchListener {
new (owner: View): android.view.View.OnTouchListener; new(owner: View): android.view.View.OnTouchListener;
} }
let TouchListener: TouchListener; let TouchListener: TouchListener;
@ -485,6 +487,13 @@ export class View extends ViewCommon {
const nativeView = this.nativeView; const nativeView = this.nativeView;
org.nativescript.widgets.ViewHelper.setBackground(nativeView, value); org.nativescript.widgets.ViewHelper.setBackground(nativeView, value);
nativeView.setPadding(this._defaultPaddingLeft, this._defaultPaddingTop, this._defaultPaddingRight, this._defaultPaddingBottom); nativeView.setPadding(this._defaultPaddingLeft, this._defaultPaddingTop, this._defaultPaddingRight, this._defaultPaddingBottom);
(<any>nativeView).background = undefined;
const cache = <CacheLayerType><any>nativeView;
if (cache.layerType !== undefined) {
cache.setLayerType(cache.layerType, null);
cache.layerType = undefined;
}
} }
} }
} }