Skip to content

Commit 42b267b

Browse files
author
Hristo Hristov
authored
paddings should be taken from style because they could be undefined from newValue (NativeScript#2433)
1 parent 8d40782 commit 42b267b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tns-core-modules/ui/core/view.android.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,12 @@ export class ViewStyler implements style.Styler {
640640
}
641641

642642
private static setPaddingProperty(view: View, newValue: Thickness) {
643-
var density = utils.layout.getDisplayDensity();
644-
var left = Math.round((newValue.left + view.borderWidth) * density);
645-
var top = Math.round((newValue.top + view.borderWidth) * density);
646-
var right = Math.round((newValue.right + view.borderWidth) * density);
647-
var bottom = Math.round((newValue.bottom + view.borderWidth) * density);
643+
let density = utils.layout.getDisplayDensity();
644+
let style = view.style;
645+
let left = Math.round((style.paddingLeft + view.borderWidth) * density);
646+
let top = Math.round((style.paddingTop + view.borderWidth) * density);
647+
let right = Math.round((style.paddingRight + view.borderWidth) * density);
648+
let bottom = Math.round((style.paddingBottom + view.borderWidth) * density);
648649
(<android.view.View>view._nativeView).setPadding(left, top, right, bottom);
649650
}
650651

0 commit comments

Comments
 (0)