fix(core): stack layout padding (#9183)

fixes #8810
This commit is contained in:
Ben Delaney
2021-01-31 04:45:59 +11:00
committed by Nathan Walker
parent ad92ba567f
commit a2896c9c63
13 changed files with 24 additions and 10 deletions

View File

@ -0,0 +1,14 @@
<Page>
<ActionBar title="issue-8810"></ActionBar>
<StackLayout
orientation="horizontal"
verticalAlignment="center"
horizontalAlignment="center"
padding="30"
borderWidth="1">
<Label
text="Play with NativeScript!"
borderWidth="1"/>
</StackLayout>
</Page>

View File

@ -33,6 +33,7 @@ export function loadExamples() {
examples.set('6439', 'issues/issue-6439-page'); examples.set('6439', 'issues/issue-6439-page');
examples.set('open-file-6895', 'issues/open-file-6895-page'); examples.set('open-file-6895', 'issues/open-file-6895-page');
examples.set("7469", "issues/issue-7469-page"); examples.set("7469", "issues/issue-7469-page");
examples.set('8810', 'issues/issue-8810-page');
return examples; return examples;
} }

View File

@ -34,7 +34,7 @@
</data> </data>
<key>Info.plist</key> <key>Info.plist</key>
<data> <data>
ADh4pPlA/MlPeoqmSDibKmrOKb0= Xj1cG5BPcNRo2kinT2TzpxSuwlc=
</data> </data>
<key>Modules/module.modulemap</key> <key>Modules/module.modulemap</key>
<data> <data>

View File

@ -1154,7 +1154,6 @@ export const iosIgnoreSafeAreaProperty = new InheritedProperty({
valueConverter: booleanConverter, valueConverter: booleanConverter,
}); });
iosIgnoreSafeAreaProperty.register(ViewCommon); iosIgnoreSafeAreaProperty.register(ViewCommon);
accessibilityIdentifierProperty.register(ViewCommon); accessibilityIdentifierProperty.register(ViewCommon);
accessibilityLabelProperty.register(ViewCommon); accessibilityLabelProperty.register(ViewCommon);
accessibilityValueProperty.register(ViewCommon); accessibilityValueProperty.register(ViewCommon);

View File

@ -113,11 +113,11 @@ export class StackLayout extends StackLayoutBase {
switch (this.verticalAlignment) { switch (this.verticalAlignment) {
case VerticalAlignment.MIDDLE: case VerticalAlignment.MIDDLE:
childTop = (bottom - top - this._totalLength) / 2 + paddingTop - paddingBottom; childTop = (bottom - top - this._totalLength) / 2 + paddingTop;
break; break;
case VerticalAlignment.BOTTOM: case VerticalAlignment.BOTTOM:
childTop = bottom - top - this._totalLength + paddingTop - paddingBottom; childTop = bottom - top - this._totalLength + paddingTop;
break; break;
case VerticalAlignment.TOP: case VerticalAlignment.TOP:
@ -147,11 +147,11 @@ export class StackLayout extends StackLayoutBase {
switch (this.horizontalAlignment) { switch (this.horizontalAlignment) {
case HorizontalAlignment.CENTER: case HorizontalAlignment.CENTER:
childLeft = (right - left - this._totalLength) / 2 + paddingLeft - paddingRight; childLeft = (right - left - this._totalLength) / 2 + paddingLeft;
break; break;
case HorizontalAlignment.RIGHT: case HorizontalAlignment.RIGHT:
childLeft = right - left - this._totalLength + paddingLeft - paddingRight; childLeft = right - left - this._totalLength + paddingLeft;
break; break;
case HorizontalAlignment.LEFT: case HorizontalAlignment.LEFT:

View File

@ -154,11 +154,11 @@ public class StackLayout extends LayoutBase {
switch (verticalGravity) { switch (verticalGravity) {
case Gravity.CENTER_VERTICAL: case Gravity.CENTER_VERTICAL:
childTop = (bottom - top - this._totalLength) / 2 + paddingTop - paddingBottom; childTop = (bottom - top - this._totalLength) / 2 + paddingTop;
break; break;
case Gravity.BOTTOM: case Gravity.BOTTOM:
childTop = bottom - top - this._totalLength + paddingTop - paddingBottom; childTop = bottom - top - this._totalLength + paddingTop;
break; break;
case Gravity.TOP: case Gravity.TOP:
@ -197,11 +197,11 @@ public class StackLayout extends LayoutBase {
switch (horizontalGravity) { switch (horizontalGravity) {
case Gravity.CENTER_HORIZONTAL: case Gravity.CENTER_HORIZONTAL:
childLeft = (right - left - this._totalLength) / 2 + paddingLeft - paddingRight; childLeft = (right - left - this._totalLength) / 2 + paddingLeft;
break; break;
case Gravity.RIGHT: case Gravity.RIGHT:
childLeft = right - left - this._totalLength + paddingLeft - paddingRight; childLeft = right - left - this._totalLength + paddingLeft;
break; break;
case Gravity.LEFT: case Gravity.LEFT: