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

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

Open
EvHaus opened this issue Feb 18, 2025 · 0 comments
Open

Comments

@EvHaus
Copy link

EvHaus commented Feb 18, 2025

Describe the bug

When using a lineHeight style, any <Text /> node with a render={...} will fail to render its content.

To Reproduce

Consider the following code:

const Test = () => (
  <Document>
    <Page style={styles.body}>
      <Text render={() => 'This does not render'} />
      <Text>But this does</Text>
      <Text>To render everything, remove the "lineHeight" style below</Text>
    </Page>
  </Document>
);

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

ReactPDF.render(<Test />);

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

Rolling back to @react-pdf/layout@4.1.1 (as per #2988 (comment)) 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

Kapture.2025-02-17.at.21.11.28.mp4

Desktop (please complete the following information):

  • OS: All
  • Browser: N/A
  • React-pdf version: @react-pdf/renderer@4.2.2
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