diegomura / diegomura/react-pdf

Using `lineHeight` combined with a "render" function causes text not to render

Open
#3,083 0 comments 6 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**

When using a `lineHeight` style, any `` node with a `render={...}` will fail to render its content.

**To Reproduce**

Consider the following code:

```ts
const Test = () => (


'This does not render'} />
But this does
To render everything, remove the "lineHeight" style below


);

const styles = StyleSheet.create({
body: {
lineHeight: '100%'
}
});

ReactPDF.render();
```

REPL reproduction: https://react-pdf.org/repl?code=3187b0760ce02e00402a05368c0bc30050129503e0c0a061801e0044460057016c130a1d0a24801404301cc119a013c01b04280379f411001d002310004d7805f46cd9b144003d600273ab2116915970c00e470005804b08316482430c086dbbf49853003d32952434300214a58282b1b3b24624f7f1f1535044d1c3810181d303d2d180400377d5e50cb300e001a54846a105c9850ee00227e42840009044b0e73285a9e28016e29047e1000772898a62228f62e1f28f22a5a7a464c006e7c7c50485831073400651ec15df304042809601d3628047461261979002e183b9506b066d6f6a867930046000300200a42626029f00a159ac004a0836300a02c52000c424690cba1e2c86f342800000

Rolling back to `@react-pdf/layout@4.1.1` (as per https://github.com/diegomura/react-pdf/issues/2988#issuecomment-2579346988) also fixes the problem.

**Expected behavior**

The "This does not render" text should render, but it doesn't. This bug might be related to #2988.

**Screenshots**

https://github.com/user-attachments/assets/b5cc9466-918b-4292-ac6e-6803000a8284

**Desktop (please complete the following information):**

- OS: All
- Browser: N/A
- React-pdf version: `@react-pdf/renderer@4.2.2`

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.