get totalPages prop in render method of Text component
See original GitHub issueDescribe the bug I am trying to display totalPages prop, but nothing is rendered. I am using version 2.0.0-beta.6 of react-pdf.
I tried to follow the example of the documentation. My code looks like this:
<Text render={({ pageNumber, totalPages }) =>
${pageNumber} / ${totalPages}} />
To Reproduce
- Install latest version of react-pdf (2.0.0-beta.6)
- Try to display totalPage prop in a text
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Windows
- Browser: Chrome
- React-pdf version v2.0.0-beta.6
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
How can I get the plain text from the render method from React ...
renderToString (this.renderParagraph()) console.log(plainText) // output in console: <p>I'm text from props of Text component!
Read more >How to Build a Custom Pagination Component in React
We often work with web applications that need to fetch large amounts of data from a server through APIs and render it on...
Read more >How To Build Custom Pagination with React | DigitalOcean
The Pagination component can take four special props as specified in the propTypes object. onPageChanged is a function called with data of the ......
Read more >Render Props - React
The term “render prop” refers to a technique for sharing code between React components using a prop whose value is a function. A...
Read more >Page wrapping - React-pdf
All you have to do is to pass a function to the render prop of the <Text /> or <View /> component. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Finally figured it out - it was a styling issue.
You have to specify the minHeight property in order to show the actual content. Here’s an example:
Thank you! It worked like a charm, with the “fixed” attribute it worked even without setting a minHeight. Before I was just setting fixed to the parent View. I ended up using an arrow function so the semicolon was unnecessary.