software-mansion / software-mansion/react-native-svg
`toDataURL` doesn't export images or fonts on the web
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8k
- Forks
- 1.2k
- Avg merge
- 10d 9h
- Merged PRs (30d)
- 2
Description
Description
I have an SVG element that contains images (both background and foreground) and custom fonts on Text elements, and I'm using toDataURL to make the SVG downloadable.
On iOS and Android everything works perfectly. On the web the SVG is initially displayed correctly in the browser, but the image produced by toDataURL is missing all of the images, and the custom fonts.
Screenshot of SVG in the app on the web:
Image produced by toDataURL on the web (missing background circles, center logo, and custom fonts):
Image produced by toDataURL on iOS:
Steps to reproduce
- Have an
Svgelement that contains an image - Run the web version of the app
- Call
toDataURLon thatSvgelement - See that the image produced by
toDataURLis missing the image element that displays in the app
Snack or a link to a repository
https://snack.expo.dev/@jagthedrummer/delicious-red-milkshake
SVG version
15.15.3
React Native version
0.79.6
Platforms
Web, iOS, Android
JavaScript runtime
None
Workflow
Expo Dev Client
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the web implementation of Svg and its toDataURL entry point, then reproduce the failure using the linked Snack on the web. Compare how image elements and custom fonts are handled during export; done means the generated data URL includes the images and fonts that appear in the SVG on web.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100