react-pdf
react-pdf copied to clipboard
Error when returning an array on render prop
Describe the bug
When I try something like:
<View
render={({ pageNumber }) => (
items.map(item => <Text>{item.label}, page: {pageNumber}</Text>)
)}
/>
React Pdf throws an exception
To Reproduce Steps to reproduce the behavior including code snippet (if applies):
- Create a document with react PDF
- Pass the render prop and return an array from there
- It throwa
Codesanbox showing the errro: https://codesandbox.io/s/objective-greider-i5p544
Expected behavior It should work normally as if the array was passed as children.
Screenshots
Desktop (please complete the following information):
- OS: Windows and Linux
- Browser Chrome
- React-pdf version v2.1.2
I also can't return a fragment or anything other than a react-pdf primitive.
I was also running into this problem and came up with a potential fix in #2056