Skip to content

fix(layout): don't leave a wrapping parent at the end of a page with only its fixed child - #3484

Closed
zewish wants to merge 1 commit into
diegomura:masterfrom
zewish:master
Closed

fix(layout): don't leave a wrapping parent at the end of a page with only its fixed child#3484
zewish wants to merge 1 commit into
diegomura:masterfrom
zewish:master

Conversation

@zewish

@zewish zewish commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Found this while exporting a print menu, where a heading was alone at the bottom of one page and appeared again above its products on the next one. We use a patch-package patch until this is (hopefully 🤞) merged and released.

Minimal reproduction

The page is 300pt tall and the first block takes 255pt of it. That leaves 45pt, which is
enough for the 20pt header but not for the 40pt row after it.

<Document>
  <Page size={{ width: 200, height: 300 }}>
    <View style={{ height: 255 }} />
    <View>
      <View fixed style={{ height: 20 }} />
      <View wrap={false} style={{ height: 40 }} />
      <View wrap={false} style={{ height: 40 }} />
      <View wrap={false} style={{ height: 40 }} />
    </View>
  </Page>
</Document>

Old behavior:

  • Page 1 ends with the header and nothing under it
  • Page 2 starts with the same header, followed by all three rows

New behavior:

  • Page 1 ends after the first block, and the header and its rows stay together on page 2

@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dcb963

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@react-pdf/layout Patch
@react-pdf/renderer Patch
@react-pdf/math Patch
@react-pdf/mermaid Patch
next-14 Patch
next-15 Patch
@react-pdf/vite-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@zewish

zewish commented Aug 19, 2026

Copy link
Copy Markdown
Author

Hey @diegomura, I would love if you're able to give me some feedback if this PR is useful to the project or not.
Feel free to close it down if it doesn't make sense.

@diegomura

Copy link
Copy Markdown
Owner

Page 1 ends after the first block, and the header and its rows stay together on page 2

Hey @zewish . Not sure how this is the expected result if the fixed view of height 20 fits in the 1st page

@zewish

zewish commented Aug 23, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback. We have since switched to a different PDF generation approach which doesn’t use react-pdf at all, so we no longer have need for this patch anyways.

@zewish zewish closed this Aug 23, 2026
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

Successfully merging this pull request may close these issues.

2 participants