From 42b267bccc7a5031c6ccdfbee91fb3d70130e499 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Fri, 8 Jul 2016 18:18:56 +0300 Subject: [PATCH] paddings should be taken from style because they could be undefined from newValue (#2433) --- tns-core-modules/ui/core/view.android.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tns-core-modules/ui/core/view.android.ts b/tns-core-modules/ui/core/view.android.ts index b118020ab..383da674a 100644 --- a/tns-core-modules/ui/core/view.android.ts +++ b/tns-core-modules/ui/core/view.android.ts @@ -640,11 +640,12 @@ export class ViewStyler implements style.Styler { } private static setPaddingProperty(view: View, newValue: Thickness) { - var density = utils.layout.getDisplayDensity(); - var left = Math.round((newValue.left + view.borderWidth) * density); - var top = Math.round((newValue.top + view.borderWidth) * density); - var right = Math.round((newValue.right + view.borderWidth) * density); - var bottom = Math.round((newValue.bottom + view.borderWidth) * density); + let density = utils.layout.getDisplayDensity(); + let style = view.style; + let left = Math.round((style.paddingLeft + view.borderWidth) * density); + let top = Math.round((style.paddingTop + view.borderWidth) * density); + let right = Math.round((style.paddingRight + view.borderWidth) * density); + let bottom = Math.round((style.paddingBottom + view.borderWidth) * density); (view._nativeView).setPadding(left, top, right, bottom); }