Skip to content

Fix BoringLayout crash when isBoring() returns negative width#56007

Closed
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D95777908
Closed

Fix BoringLayout crash when isBoring() returns negative width#56007
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D95777908

Conversation

@NickGerleman
Copy link
Copy Markdown
Contributor

Summary:
Fix a crash in TextLayoutManager.isBoring() where BoringLayout.isBoring() sometimes returns metrics with a negative width for certain strings, even on Android 15+. This causes issues downstream when the layout is created.

The fix checks if the returned metrics have a negative width and falls back to StaticLayout instead, which (theoretically) handles these edge cases correctly.

Changelog:

[Android][Fixed] - Fix BoringLayout crash when isBoring() returns negative width

Differential Revision: D95777908

Summary:
Fix a crash in `TextLayoutManager.isBoring()` where `BoringLayout.isBoring()` sometimes returns metrics with a negative width for certain strings, even on Android 15+. This causes issues downstream when the layout is created.

The fix checks if the returned metrics have a negative width and falls back to `StaticLayout` instead, which (theoretically) handles these edge cases correctly.

Changelog:

[Android][Fixed] - Fix BoringLayout crash when isBoring() returns negative width

Differential Revision: D95777908
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 9, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 9, 2026

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95777908.

@meta-codesync meta-codesync Bot closed this in d527f2d Mar 9, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 9, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 9, 2026

This pull request has been merged in d527f2d.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @NickGerleman in d527f2d

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants