diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.22k stars 1.11k forks source link

minHeight causes overlapping with fixed elements #2728

Open Mudbill opened 3 weeks ago

Mudbill commented 3 weeks ago

Describe the bug

If you have a repeating element that wraps across multiple pages, while also using fixed elements that should appear on multiple pages, if you add a minHeight style to the repeating row, it appears to ignore the fixed space already consumed by the other elements. Interestingly, this doesn't happen if you use height instead.

To Reproduce

REPL Reproduction

(Also try to replace minHeight with height. A different but possibly related issue appears on page 2)

const lines = new Array(100).fill(null);

const PDF = () => (
  <Document>
    <Page>
      <View fixed>
        <Text>This is a header on each page</Text>
      </View>
      {lines.map((_, i) => (
        <View key={i} style={{ minHeight: 30 }} debug>
          <Text>Row {i + 1}</Text>
        </View>
      ))}
    </Page>
  </Document>
);

Expected behavior I expect the repeating rows to respect the space already occupied by the fixed elements.

Desktop (please complete the following information):