diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.63k stars 1.16k forks source link

Render Image inside a Fixed View tag with render function causes undefined, reading 'width' issue #1587

Open morningcocoa opened 2 years ago

morningcocoa commented 2 years ago

I get error: Error: TypeError: Cannot read properties of undefined (reading 'width')

when trying to add an image/logo to a fixed View tag, and it needs to be the render function because I need the pageNumber logic

<View style={styles.pageNumber} render={({ pageNumber, totalPages }) => (
    <Image src="https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" />
  )} fixed />

This use to work in 1.6, and I may have to revert back to version1

petercsaki commented 2 years ago

Having the same problem. It doesn't have to be fixed. Image in a View's render is having this problem. https://github.com/diegomura/react-pdf/blob/1f0eb6e0d4e75480de6745a204924d5075859db7/packages/render/src/primitives/renderImage.js#L23 node.image is undefined

ravithesun02 commented 1 year ago

any workaround for this issue ?

ravithesun02 commented 1 year ago

I am facing the same issue in latest version as well . i am using @react-pdf/renderer

Ionito commented 11 months ago

Hi, any solution to this issue? :-(

vilenleung commented 10 months ago

emm....it's not fixed now?

jegangits commented 9 months ago

emm....it's not fixed now?

yes still i am getting errors like that

Justinio99 commented 8 months ago

I just created a PR for this issue:

2465