FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

vertical-alignment middle support added · NativeScript/NativeScript@19b03bb · GitHub

Commit 19b03bb

Browse files
Vladimir Enchev
committed
vertical-alignment middle support added
1 parent d2571e1 commit 19b03bb

6 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/tests/ui/style/style-properties-tests.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@ export function test_setting_minHeight_property_from_CSS_is_applied_to_Style() {
9191
}
9292

9393
export function test_setting_verticalAlignment_property_from_CSS_is_applied_to_Style() {
94-
9594
test_property_from_CSS_is_applied_to_style("verticalAlignment", "vertical-align", "bottom");
9695
}
9796

97+
export function test_setting_verticalAlignment_middle_is_applied_to_Style() {
98+
test_property_from_CSS_is_applied_to_style("verticalAlignment", "vertical-align", "middle");
99+
}
100+
98101
export function test_setting_horizontalAlignment_property_from_CSS_is_applied_to_Style() {
99102
test_property_from_CSS_is_applied_to_style("horizontalAlignment", "horizontal-align", "right");
100103
}

‎ui/core/view-common.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ export class View extends proxy.ProxyObject implements definition.View {
717717
childTop = top + child.marginTop * density;
718718
break;
719719

720-
case enums.VerticalAlignment.center:
720+
case enums.VerticalAlignment.center || enums.VerticalAlignment.middle:
721721
childTop = top + (bottom - top - childHeight + (child.marginTop - child.marginBottom) * density) / 2;
722722
break;
723723

‎ui/enums/enums.d.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@
161161
*/
162162
export var center: string;
163163

164+
/**
165+
* Same as center. An element should be aligned in the middle.
166+
*/
167+
export var middle: string;
168+
164169
/**
165170
* An element should be bottom aligned.
166171
*/

‎ui/enums/enums.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export module HorizontalAlignment {
4141
export module VerticalAlignment {
4242
export var top = "top";
4343
export var center = "center";
44+
export var middle = "middle";
4445
export var bottom = "bottom";
4546
export var stretch = "stretch";
4647
}

‎ui/layouts/stack-layout/stack-layout.ios.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class StackLayout extends common.StackLayout {
114114
var childRight = right - left - paddingRight;
115115

116116
switch (this.verticalAlignment) {
117-
case enums.VerticalAlignment.center:
117+
case enums.VerticalAlignment.center || enums.VerticalAlignment.middle:
118118
childTop = (bottom - top - this._totalLength) / 2 + paddingTop - paddingBottom;
119119
break;
120120

‎ui/styling/stylers.android.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class DefaultStyler implements definition.stylers.Styler {
175175
gravity |= android.view.Gravity.TOP;
176176
break;
177177

178-
case enums.VerticalAlignment.center:
178+
case enums.VerticalAlignment.center || enums.VerticalAlignment.middle:
179179
gravity |= android.view.Gravity.CENTER_VERTICAL;
180180
break;
181181

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL