diff --git a/tests/app/ui/label/label-tests.ts b/tests/app/ui/label/label-tests.ts index 92b68fc0c..3a89ae1cd 100644 --- a/tests/app/ui/label/label-tests.ts +++ b/tests/app/ui/label/label-tests.ts @@ -551,8 +551,8 @@ export class LabelTest extends testModule.UITest { } } - public test_SettingTextWhenInFixedSizeGridShouldRequestLayout() { - this.requestLayoutFixture(true, "", () => { + public test_SettingTextWhenInFixedSizeGridShouldNotRequestLayout() { + this.requestLayoutFixture(false, "", () => { let host = new GridLayout(); host.width = 100; host.height = 100; @@ -569,8 +569,8 @@ export class LabelTest extends testModule.UITest { }); } - public test_SettingTextWhenFixedWidthAndHeightDoesRequestLayout() { - this.requestLayoutFixture(true, "", label => { + public test_SettingTextWhenFixedWidthAndHeightDoesNotRequestLayout() { + this.requestLayoutFixture(false, "", label => { let host = new StackLayout(); label.width = 100; label.height = 100; diff --git a/tns-core-modules/ui/label/label.ios.ts b/tns-core-modules/ui/label/label.ios.ts index 2867b8054..1354180ca 100644 --- a/tns-core-modules/ui/label/label.ios.ts +++ b/tns-core-modules/ui/label/label.ios.ts @@ -45,15 +45,13 @@ export class Label extends common.Label { } _requestLayoutOnTextChanged(): void { - console.log("requestLayout called --------------------------------------->"); if (this._fixedSize === FixedSize.BOTH) { return; } - if (this._fixedSize === FixedSize.WIDTH && !this.textWrap) { + if (this._fixedSize === FixedSize.WIDTH && !this.textWrap && this.getMeasuredHeight() > 0) { // Single line label with fixed width will skip request layout on text change. return; } - console.log("actual requestLayout called --------------------------------------->"); super._requestLayoutOnTextChanged(); } @@ -74,13 +72,13 @@ export class Label extends common.Label { height = Number.POSITIVE_INFINITY; } - if (this.text !== "") { + //if (this.text !== "") { this._fixedSize = (widthMode === utils.layout.EXACTLY ? FixedSize.WIDTH : FixedSize.NONE) | (heightMode === utils.layout.EXACTLY ? FixedSize.HEIGHT : FixedSize.NONE); - } - else { - this._fixedSize = FixedSize.NONE; - } + //} + //else { + // this._fixedSize = FixedSize.NONE; + //} var nativeSize = nativeView.sizeThatFits(CGSizeMake(width, height)); var labelWidth = nativeSize.width;