diegomura / diegomura/react-pdf

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

Open
#3,123 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**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 = () => (



This does not render} />


"This does not render"} />

This does render} />

This does render} />



);

ReactPDF.render();
```

[react-pdf REPL to reproduce](https://react-pdf.org/repl?code=3187b0760ce02e00402a05368c0bc30050129503e0c0a061801e0044460057016c130a1d0a24801404301cc1479e78c40078326bc0243f0442600273a004c1349401bcb2e128219c0016012c20c392090c302162cb00ba7100f49a7005f18b67af12f7270f71abdbb1125296d62a6a287800443afa86c6066616f28a11ceae227c9e42fe7c9a32494aaad8e1be59d1064626c18a760ea9d976ec5c6e76e454b4f48c9800dcf8f8004a086cc0502ca40062007455d2e812c8aeddf8400000)

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

Likely related:
https://github.com/diegomura/react-pdf/issues/3083
https://github.com/diegomura/react-pdf/issues/2988
https://github.com/diegomura/react-pdf/issues/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 `` element to enable inline flowing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.