Can't dynamically render two Text components
See original GitHub issueI want to put two separate <Text> elements in my footer with different styling, both of which need access to the totalPages, however for some reason only the first one is ever displayed.
Can reproduced on the page wrap example (https://react-pdf.org/repl?example=page-wrap) by replacing the single page number <Text> element with the following:
<Text style={styles.pageNumber} render={({ pageNumber, totalPages }) => (
`a ${pageNumber} / ${totalPages}`
)} fixed />
<Text style={[styles.pageNumber, {bottom: 0}]} render={({ pageNumber, totalPages }) => (
`b ${pageNumber} / ${totalPages}`
)} fixed />
I would expect to see the ‘b’ element at the bottom of the screen, with the ‘a’ above it, but I only see ‘a’
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
I am unable to render components dynamically in react.js
So, I started working in react and got stuck, when I was trying to render a component dynamically into the view, from a...
Read more >React Tutorial #4 - Dynamically Rendering Multiple Components
... try restarting your device. Your browser can't play this video. ... React Tutorial #4 - Dynamically Rendering Multiple Components.
Read more >Dynamically Importing Components with React.lazy
In React, dynamically importing a component is easy—you invoke React.lazy with the standard dynamic import syntax and specify a fallback UI.
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 >View - React Native
The most fundamental component for building a UI, View is a ... that wraps two boxes with color and a text component in...
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
<View>
is not really supported (I’ve experimented stuff like that and inspected the source code) in the render of<Text>
. Just use aReact.Fragment
instead.Ah, thank you. I didn’t think you were allowed to put a View instead of the Text render, but that was because it crashes if you’re using styled components for the view/text.