From a17cd1169cd80f93da966a5ec94ed3606cf847c8 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Wed, 19 Jul 2017 15:39:07 +0300 Subject: [PATCH] fix layer type recycling (#4574) --- tns-core-modules/ui/core/view/view.android.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index a9013296f..c2df4b4ba 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -1,6 +1,7 @@ // Definitions. import { Point, CustomLayoutView as CustomLayoutViewDefinition, dip } from "."; import { GestureTypes, GestureEventData } from "../../gestures"; +import { CacheLayerType } from "../../../utils/utils"; // Types. import { Background, ad as androidBackground } from "../../styling/background"; @@ -17,12 +18,13 @@ import { rotateProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty } from "../../styling/style-properties"; + import { profile } from "../../../profiling"; export * from "./view-common"; interface TouchListener { - new (owner: View): android.view.View.OnTouchListener; + new(owner: View): android.view.View.OnTouchListener; } let TouchListener: TouchListener; @@ -485,6 +487,13 @@ export class View extends ViewCommon { const nativeView = this.nativeView; org.nativescript.widgets.ViewHelper.setBackground(nativeView, value); nativeView.setPadding(this._defaultPaddingLeft, this._defaultPaddingTop, this._defaultPaddingRight, this._defaultPaddingBottom); + + (nativeView).background = undefined; + const cache = nativeView; + if (cache.layerType !== undefined) { + cache.setLayerType(cache.layerType, null); + cache.layerType = undefined; + } } } }