diegomura / diegomura/react-pdf
Styling based off page number
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
### Discussed in https://github.com/diegomura/react-pdf/discussions/1803
Originally posted by **dani-abou** May 2, 2022
Hello!
I want to change a page's padding based off page number, so even pages will have bigger padding on the right, and vise versa.
I am trying to use something like this https://react-pdf.org/advanced#dynamic-content, by having a custom `Page` containing one `View` with a render prop returning another `View` that styles according to the page number. The `children` of the custom component should be passed as the `children` of that innermost `View`.
But, I have some styling on the `children` that is getting lost somewhere along the way.
Here is the custom component:

Here is the `children` component that is losing styling

Here's what it's supposed to look like (ie passing through Page from line 22 instead of Dummy), without desired page number padding

And here is what it looks like going through Dummy:

Contributor guide
Assessment
This issue has not been assessed yet.