diegomura / diegomura/react-pdf

<Image src={src}/> returned from render function crashes react-pdf

Open
#1,630 5 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
When returning an `` component from a render function react-pdf crashes with an error
```
TypeError: Cannot read properties of undefined (reading 'width')
at renderImage.js:36
at _pipe.js:3
at _pipe.js:3
at _arity.js:10
at renderImage (renderImage.js:58)
at _curryN.js:34
at _arity.js:10
at cond.js:42
at _arity.js:10
at _pipe.js:3
at _pipe.js:3
at _pipe.js:3
at _pipe.js:3
at _pipe.js:3
at _pipe.js:3
at _arity.js:10
at renderNode.js:80
.........
```

**To Reproduce**
```javascript
import logo_code from './assets/logo.png';
....
return (




} />

)
```

**Expected behavior**
The document renders the same way regardless if the children are returned from the render method or supplied as children to the component.

**Desktop (please complete the following information):**
- OS: Windows
- Browser Chrome Version 96.0.4664.45 (Official Build) (64-bit)
- React-pdf version "^2.0.21"

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.