Label zero height issue fixed.

This commit is contained in:
Nedyalko Nikolov
2016-08-16 16:33:56 +03:00
parent 3968d6fb82
commit 97a1ad6a7a
2 changed files with 64 additions and 12 deletions

View File

@@ -45,6 +45,7 @@ export class Label extends common.Label {
}
_requestLayoutOnTextChanged(): void {
console.log("requestLayout called --------------------------------------->");
if (this._fixedSize === FixedSize.BOTH) {
return;
}
@@ -52,6 +53,7 @@ export class Label extends common.Label {
// Single line label with fixed width will skip request layout on text change.
return;
}
console.log("actual requestLayout called --------------------------------------->");
super._requestLayoutOnTextChanged();
}
@@ -72,8 +74,13 @@ export class Label extends common.Label {
height = Number.POSITIVE_INFINITY;
}
this._fixedSize = (widthMode === utils.layout.EXACTLY ? FixedSize.WIDTH : FixedSize.NONE)
| (heightMode === utils.layout.EXACTLY ? FixedSize.HEIGHT : FixedSize.NONE);
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;
}
var nativeSize = nativeView.sizeThatFits(CGSizeMake(width, height));
var labelWidth = nativeSize.width;