From a03065c52743115abd08cba02f7fb5544abfb1b6 Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Fri, 25 May 2018 11:43:00 +0300 Subject: [PATCH] fix(flexbox-ios): resolve text size issue for ListView with flexbox layout template (#5799) * fix(flexbox-layout-ios): resolve text size issue for ListView with flexbox template * fix(flexbox-layout-ios): resolve text size issue for ListView --- .../layouts/flexbox-layout/flexbox-layout.ios.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.ios.ts b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.ios.ts index 89021c4de..d376de88a 100644 --- a/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.ios.ts +++ b/tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.ios.ts @@ -604,7 +604,7 @@ export class FlexboxLayout extends FlexboxLayoutBase { // As a result we cannot unconditionally measure with EXACTLY the current measured height const childHeightMeasureSpec = FlexboxLayout.getChildMeasureSpec(this._currentHeightMeasureSpec, lp.effectivePaddingTop + lp.effectivePaddingBottom + lp.effectiveMarginTop - + lp.effectiveMarginBottom, lp.effectiveHeight < 0 ? WRAP_CONTENT : lp.effectiveHeight); + + lp.effectiveMarginBottom, lp.effectiveHeight < 0 ? WRAP_CONTENT : lp.effectiveHeight); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); child.effectiveMinWidth = minWidth; @@ -820,7 +820,17 @@ export class FlexboxLayout extends FlexboxLayoutBase { private _stretchViewVertically(view: View, crossSize: number) { let newHeight = crossSize - view.effectiveMarginTop - view.effectiveMarginBottom; newHeight = Math.max(newHeight, 0); - view.measure(makeMeasureSpec(view.getMeasuredWidth(), EXACTLY), makeMeasureSpec(newHeight, EXACTLY)); + let originalMeasuredWidth = view.getMeasuredWidth(); + let childWidthMeasureSpec = FlexboxLayout.getChildMeasureSpec(this._currentWidthMeasureSpec, + view.effectivePaddingLeft + view.effectivePaddingRight + view.effectiveMarginLeft + + view.effectiveMarginRight, view.effectiveWidth < 0 ? WRAP_CONTENT : Math.min(view.effectiveWidth, originalMeasuredWidth)); + + view.measure(childWidthMeasureSpec, makeMeasureSpec(newHeight, EXACTLY)); + + if (originalMeasuredWidth > view.getMeasuredWidth()) { + childWidthMeasureSpec = makeMeasureSpec(originalMeasuredWidth, EXACTLY); + view.measure(childWidthMeasureSpec, makeMeasureSpec(newHeight, EXACTLY)); + } } private _stretchViewHorizontally(view: View, crossSize: number) {