Repository navigation
Add getTextLayout() to Text refs (#60414) - #60414
Merged
Merged
Conversation
|
@markv has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134142257. |
rubennorte
approved these changes
Nov 30, 2026
rubennorte
left a comment
Member
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
Summary:
`onTextLayout` reaches JS after the first frame with the text is drawn, so output that depends on a text's lines shows unadjusted for a few frames.
This adds `getTextLayout()` to refs of a `<Text>` not nested in another `<Text>`. It synchronously returns `{lines}`, the same shape and lines as the `onTextLayout` event, so a layout effect can use them in the same commit.
- `ParagraphShadowNode` keeps the lines it measures for `onTextLayout` and exposes them through `TextLayoutLinesProvider`, a header-only interface.
- `dom::getTextLayoutLines` reads them through that interface; `NativeDOM.getTextLayout` resolves the revision and builds the `{lines}` object.
- `Text` adds the method before the ref receives the instance, only when a ref is passed; nested texts don't get it.
Changelog:
[General][Added] - Add `getTextLayout()` to `<Text>` refs
Reviewed By: rubennorte
Differential Revision: D134142257
markv
force-pushed
the
export-D134142257
branch
from
December 1, 2026 23:59
5e61d9a to
b62957a
Compare
Collaborator
|
This pull request was successfully merged by @markv in 2d0b824 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
onTextLayoutreaches JS after the first frame with the text is drawn, so output that depends on a text's lines shows unadjusted for a few frames.This adds
getTextLayout()to refs of a<Text>not nested in another<Text>. It synchronously returns{lines}, the same shape and lines as theonTextLayoutevent, so a layout effect can use them in the same commit.ParagraphShadowNodekeeps the lines it measures foronTextLayoutand exposes them throughTextLayoutLinesProvider, a header-only interface.dom::getTextLayoutLinesreads them through that interface;NativeDOM.getTextLayoutresolves the revision and builds the{lines}object.Textadds the method before the ref receives the instance, only when a ref is passed; nested texts don't get it.Changelog:
[General][Added] - Add
getTextLayout()to<Text>refsReviewed By: rubennorte
Differential Revision: D134142257