Skip to content

Fix text truncation by updating Yoga to 3.2.2 - #289

Merged
OhKanghoon merged 2 commits into
layoutBox:masterfrom
stleamist:fix/yoga-text-truncation
Nov 6, 2026
Merged

OhKanghoon merged 2 commits into
layoutBox:masterfrom
stleamist:fix/yoga-text-truncation

Conversation

@stleamist

Copy link
Copy Markdown
Contributor

Yoga 3.2.1 can shrink a measured text node by one physical pixel at a fractional offset, causing a UILabel to truncate text that should fit. Update the minimum Yoga version to 3.2.2, which backports react/yoga#2040, while retaining the .upToNextMinor requirement (3.2.2..<3.3.0).

Add a minimal regression test with “Balance” and a right-aligned “$36.50” UILabel, both using a fixed 17pt system font. In a 393pt-wide container, querying the intrinsic size before layout triggers the bug. The test uses UIKit’s actual measurements, with no spacing adjustments, measurement stubs, or collection view. It checks that the final label width is at least its intrinsic content width.

The commits introduce the regression test first, then update Yoga to fix it.

Validation

  • With Yoga pinned to 3.2.1 in an isolated copy, the regression test fails: the amount measures 55pt but is assigned approximately 54.6667pt, losing one physical pixel at @3x.
  • With Yoga 3.2.2, all 76 tests pass on the iOS 27.2 @3x simulator with Xcode 27.2.
  • SwiftLint passes for the added test file, and git diff --check passes.
  • Release builds for the library and the SPM sample, and version-tagged consumer dependency resolution, were verified with the same Yoga 3.2.2 dependency change.

Visual comparison

The same layout rendered with a 17pt system font on an iOS 27.2 @3x simulator. Only the Yoga version changes. The measured amount width is 55pt in both cases.

Yoga 3.2.1 — assigned width: 54.6667pt Yoga 3.2.2 — assigned width: 55pt
Text truncated with Yoga 3.2.1 Full text with Yoga 3.2.2

@OhKanghoon OhKanghoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@OhKanghoon
OhKanghoon merged commit 050d931 into layoutBox:master Nov 6, 2026
1 check passed
@OhKanghoon OhKanghoon self-assigned this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants