react-pdf
react-pdf copied to clipboard
toBlob throws an error with react-pdf elements (Svg, Defs)
Describe the bug
toBlob throws an error with some react-pdf elements (Svg, Defs)
Error: renderFn is not a function
To Reproduce Next.js, react-pdf version: 3.3.8
With Defs, toBlob throws an error, but if I delete it and add a standard fill color to the circle, it works correctly.
<G>
<Defs>
<LinearGradient id="myLinearGradient">
<Stop offset="5%" stopColor="gold" />
<Stop offset="95%" stopColor="red" />
</LinearGradient>
</Defs>
<Circle cx="5" cy="5" r="4" fill="url(‘#myLinearGradient’)" />
</G>
I have the same problemðŸ˜ðŸ˜ðŸ˜ < Defs> Without Tegg, no problem will arise.
It looks like In reaact-pdf Defs is only supported as a child of Svg
This PR https://github.com/diegomura/react-pdf/pull/2836 will at least write to the console the original problem instead of throwing the error: "Error: renderFn is not a function"