Skip to content

Commit 4877598

Browse files
author
farfromrefug
committed
Merge remote-tracking branch 'origin/master'
2 parents 4f30f72 + a118e3f commit 4877598

File tree

6 files changed

+48
-15
lines changed

6 files changed

+48
-15
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [1.3.26](https://github.com/Akylas/nativescript-label/compare/v1.3.25...v1.3.26) (2024-03-18)
7+
8+
### Bug Fixes
9+
10+
- **ios:** formattedtext not working with button ([707ac80](https://github.com/Akylas/nativescript-label/commit/707ac80f719927c0964778d3753e9ed116c0c917))
11+
12+
## [1.3.25](https://github.com/Akylas/nativescript-label/compare/v1.3.24...v1.3.25) (2024-03-06)
13+
14+
### Bug Fixes
15+
16+
- **ios:** multiple fixes for autoFonSize ([f41473e](https://github.com/Akylas/nativescript-label/commit/f41473e7429606017beb427fd9fe70e06d1a082f))
17+
618
## [1.3.24](https://github.com/nativescript-community/ui-label/compare/v1.3.23...v1.3.24) (2024-03-05)
719

820
### Bug Fixes

demo-vue/app/views/Home.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<HTMLLabel fontSize="16" fontWeight="bold" text="test"/>
1313
<Label fontSize="16" fontWeight="bold" text="test"/>
1414
<Label text="test" fontWeight="bold" fontSize="16"/>
15+
<Button backgroundColor="red">
16+
<FormattedString>
17+
<Span text="hello world"></Span>
18+
</FormattedString>
19+
</Button>
1520
</StackLayout>
1621
<ListView ref="listView" itemRowHeight="80" for="example in examples" separatorColor="transparent" @itemTap="goToExample" row="1">
1722
<v-template>

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"packages": ["plugin"],
3-
"version": "1.3.24",
3+
"version": "1.3.26",
44
"command": {
55
"publish": {
66
"conventionalCommits": true

plugin/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [1.3.26](https://github.com/nativescript-community/ui-label/compare/v1.3.25...v1.3.26) (2024-03-18)
7+
8+
### Bug Fixes
9+
10+
- **ios:** formattedtext not working with button ([707ac80](https://github.com/nativescript-community/ui-label/commit/707ac80f719927c0964778d3753e9ed116c0c917))
11+
12+
## [1.3.25](https://github.com/nativescript-community/ui-label/compare/v1.3.24...v1.3.25) (2024-03-06)
13+
14+
**Note:** Version bump only for package @nativescript-community/ui-label
15+
616
## [1.3.24](https://github.com/nativescript-community/ui-label/compare/v1.3.23...v1.3.24) (2024-03-05)
717

818
**Note:** Version bump only for package @nativescript-community/ui-label

plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript-community/ui-label",
3-
"version": "1.3.24",
3+
"version": "1.3.26",
44
"description": "Alternative to the built-in NativeScript Label but with better performance and additional features such as HTML rendering and more.",
55
"main": "./label",
66
"sideEffects": false,
@@ -32,7 +32,7 @@
3232
"license": "Apache-2.0",
3333
"readmeFilename": "README.md",
3434
"dependencies": {
35-
"@nativescript-community/text": "^1.5.45"
35+
"@nativescript-community/text": "^1.5.47"
3636
},
3737
"gitHead": "a08eb50756c9a5d16fc8aa6ff7fba0051c71d1e0"
3838
}

src/label.ios.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,16 @@ export class Label extends LabelBase {
368368
return inset;
369369
}
370370

371-
_requestLayoutOnTextChanged(): void {
371+
_requestLayoutOnTextChanged() {
372372
if (this.mFixedSize === FixedSize.BOTH) {
373-
return;
373+
return false;
374374
}
375375
if (this.mFixedSize === FixedSize.WIDTH && !this.textWrap && this.getMeasuredHeight() > 0) {
376376
// Single line label with fixed width will skip request layout on text change.
377-
return;
377+
return false;
378378
}
379379
super._requestLayoutOnTextChanged();
380+
return true;
380381
}
381382

382383
private _measureNativeView(
@@ -414,6 +415,11 @@ export class Label extends LabelBase {
414415

415416
const height = Utils.layout.getMeasureSpecSize(heightMeasureSpec);
416417
const heightMode = Utils.layout.getMeasureSpecMode(heightMeasureSpec);
418+
419+
this.mFixedSize =
420+
(widthMode === Utils.layout.EXACTLY ? FixedSize.WIDTH : FixedSize.NONE) |
421+
(heightMode === Utils.layout.EXACTLY ? FixedSize.HEIGHT : FixedSize.NONE);
422+
417423
let resetFont;
418424
// reset insent or it will taken into account for measurement
419425
if (this.autoFontSize) {
@@ -727,11 +733,10 @@ export class Label extends LabelBase {
727733
}
728734
// no need to update veticalAlignment or autoSize as we ask for a layout
729735
// will be done in onMeasure and onLayout
730-
// this.updateVerticalAlignment();
731-
// if (this.autoFontSize) {
732-
// this.updateAutoFontSize({ textView: this.nativeTextViewProtected, force: true });
733-
// }
734-
this._requestLayoutOnTextChanged();
736+
737+
if (!this._requestLayoutOnTextChanged() && this.autoFontSize) {
738+
this.updateAutoFontSize({ textView: this.nativeTextViewProtected, force: true });
739+
}
735740
}
736741

737742
setTextDecorationAndTransform() {
@@ -917,8 +922,8 @@ export class Label extends LabelBase {
917922
return currentFont;
918923
}
919924
const textViewSize = NSLabelUtils.insetWithRectUIEdgeInsets(textView.bounds, textView.padding).size;
920-
const fixedWidth = Math.floor(width !== undefined ? width : textViewSize.width);
921-
const fixedHeight = Math.floor(height !== undefined ? height : textViewSize.height);
925+
const fixedWidth = Math.ceil(width !== undefined ? width : textViewSize.width);
926+
const fixedHeight = Math.ceil(height !== undefined ? height : textViewSize.height);
922927
if (fixedWidth === 0 || fixedHeight === 0) {
923928
return currentFont;
924929
}
@@ -992,8 +997,9 @@ export class Label extends LabelBase {
992997
if (!onlyMeasure) {
993998
this.fontSizeRatio = expectFont.pointSize / fontSize;
994999
}
995-
996-
this.updateVerticalAlignment();
1000+
if (!onlyMeasure) {
1001+
this.updateVerticalAlignment();
1002+
}
9971003
}
9981004
return currentFont;
9991005
}

0 commit comments

Comments
 (0)