diegomura / diegomura/react-pdf

Styling based off page number

Open
#1,804 8 comments 4 reactions 0 assignees View on GitHub
new feature
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:
image

Here is the `children` component that is losing styling
image

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

And here is what it looks like going through Dummy:
image

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.