fix for dynamic image render
There are ongoing challenges with dynamically rendering the <Image /> component. The primary issue identified was the absence of image properties on the child node. To rectify this, I introduced a new validation step for the Image type, ensuring the creation of a new node instance with the appropriate attributes.
if (isImage(element)) {
const node = { props, type, style, box: {} };
await fetchImage(node);
return [node];
}
To facilitate this solution, I needed to modify several functions to execute asynchronously, particularly because fetchImage was already an asynchronous function.
As my expertise with react-pdf is limited, I'm hopeful that this solution proves effective. I'm more than open to feedback and help in this area.
🦋 Changeset detected
Latest commit: 5c2d111c9e90b69e4964749bc2efb72e5348b2ce
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
| Name | Type |
|---|---|
| @react-pdf/layout | Minor |
| @react-pdf/renderer | Patch |
| @react-pdf/examples | Patch |
| @react-pdf/e2e-node-cjs | Patch |
| @react-pdf/e2e-node-esm | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Tests do not pass for me with the fix.
Would appreciate this fix a lot! :)