Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested <Text>'s with a render function don't render #3123

Open
tom2strobl opened this issue Mar 11, 2025 · 1 comment
Open

Nested <Text>'s with a render function don't render #3123

tom2strobl opened this issue Mar 11, 2025 · 1 comment

Comments

@tom2strobl
Copy link

tom2strobl commented Mar 11, 2025

Describe the bug
https://react-pdf.org/components#text states that
Text supports nesting of other Text or Link components to create inline styling.
but nesting Text with a render function does not render the text at all.
This worked in 3.x previously, if that helps.

To Reproduce

const Test = () => (
  <Document>
    <Page>
      <Text>
      	<Text render={() => <Text>This does not render</Text>} />
      </Text>
      <Text>
      	<Text render={() => "This does not render"} />
      </Text>
      <Text render={() => <Text>This does render</Text>} />
      <View>
        <Text render={() => <Text>This does render</Text>} />
      </View>
    </Page>
  </Document>
);

ReactPDF.render(<Test />);

react-pdf REPL to reproduce

Expected behavior
Nested Texts are expected to render when using a render function.

Likely related:
#3083
#2988
#3044

Why do we want to nest Texts in the first place?
We have textboxes with arbitrary content which can also be variables that are interpolated on generation. Within a Textblock there should be flow and one of the variables is pageNumber, where we need to use a render function to get the number. Now a pageNumber can be within a paragraph which should be a <Text> element to enable inline flowing.

@tom2strobl
Copy link
Author

Probably related: #2258

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

No branches or pull requests

1 participant