Skip to content

fix(flexbox): allow sub-pixel slack when measuring text against yoga widths - #131

Merged
RuudBurger merged 1 commit into
mainfrom
ruud/text-measure-float-slack
Oct 12, 2026
Merged

RuudBurger merged 1 commit into
mainfrom
ruud/text-measure-float-slack

Conversation

@RuudBurger

Copy link
Copy Markdown
Member

Yoga hands the measure function a float32-rounded width that can be a hair smaller than the text's own width, and layoutText compares with no tolerance. So short labels like "TV-14" split into "TV-1" / "4" and "R" rendered as an empty box (RNG-908, rating badge in the RN Lightning preplay). It depends on which way the rounding goes, so PG-13 and TV-MA were fine.

Adds 0.01px of slack in YogaManager._measureText when the width is bounded. Way below one glyph, and the renderer already gets +2px when it paints, so real wrapping doesn't change. Covers the worker path too since it runs the same YogaManager. New integration test fails without the fix.

react-native-client carries this as a pnpm patch on 1.0.0-alpha.5 for now.

@RuudBurger
RuudBurger marked this pull request as ready for review October 12, 2026 14:24
@RuudBurger
RuudBurger merged commit b6762ab into main Oct 12, 2026
1 check passed
@RuudBurger
RuudBurger deleted the ruud/text-measure-float-slack branch October 12, 2026 14:25
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.

1 participant