Repository navigation
Conversation
Pagination only reset the measured lines of a text that has a render
prop itself. A static <Text> whose nested <Text render={...}> produced
the content kept the lines measured before the render prop ran, so the
nested result was never laid out and nothing was drawn.
Reset the lines and height of any text that contains a dynamic
descendant.
Fixes diegomura#3123
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a34aec8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@adarshsm is attempting to deploy a commit to the diegomura Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Fixes #3123.
Problem
A
renderprop on a<Text>nested inside another<Text>never shows up in the PDF:The same render prop works when it sits on the outer
<Text>or on a<Text>in a<View>, which is why the issue reports it as a regression from 3.x.Root cause
resolveDynamicNodesinresolvePagination.tscalls the render props and then runs the page throughrelayoutPage. It only clearslines(and the box height) on nodes that are dynamic themselves. The outer<Text>is static, so it keeps thelinesthat were measured on the first pass, when the nested text still had no children.resolveTextLayoutskips nodes that already havelines, so the nested result never gets laid out and the text stays empty.Fix
Reset
linesandbox.heightfor every<Text>that contains a dynamic node (shouldResolveDynamicNodes), not only for dynamic ones. Yoga then re-measures it with the resolved children.Tests
should lay out the result of a render prop on a nested textinpackages/layout/tests/steps/resolvePagination.test.ts. It fails without the change (the text has no lines) and passes with it.packages/layout/tests/{steps,text,node}pass (332 tests). Thepaginate/*andengineSelectionsuites can't load in my checkout (@react-pdf/paginateisn't linked), so they were not run.paginateengine has its ownrenderDynamic, which looks like it has the same gap for a static outer text. I did not touch it because I couldn't run its tests here.🤖 Generated with Claude Code