software-mansion / software-mansion/react-native-svg

`toDataURL` doesn't export images or fonts on the web

Open
#2,887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Repro provided
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

Image produced by toDataURL on the web (missing background circles, center logo, and custom fonts):

Image

Image produced by toDataURL on iOS:

Image

Steps to reproduce
  1. Have an Svg element that contains an image
  2. Run the web version of the app
  3. Call toDataURL on that Svg element
  4. See that the image produced by toDataURL is 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.