mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Label zero height issue fixed.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user