[Android] SVG rendered as text instead of image
See original GitHub issueI’m trying to render a remote SVG. I’m on 2.0.6
, Android 12 and Chrome is on version 91.0.4472.114
.
Here is the snippet I’m using:
<Image
source={{ uri: 'https://s3.amazonaws.com/cdn.titanvest.com/misc/car-hex.svg' }}
style={{ width: 100, height: 100 }} //needs the size
/>
Even using inlined svg doesn’t work:
<Image
source={{
uri: `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="100px" viewBox="0 0 100 100">
<ellipse data-custom-shape="ellipse" cx="50" cy="50" rx="50" ry="50" fill="green" stroke="#00FF00" stroke-width ="2" />
</svg>`,
}}
style={{ width: 300, height: 300 }}
All I get is this:
The same piece of code works perfectly on iOS.
How can I fix it?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why text attribute in SVG file does not appear in Android ...
I think the text attribute is somehow not interpreted by Android Studio. I was able to solve the problem by converting the text...
Read more >Add multi-density vector graphics - Android Developers
Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and ...
Read more >text-rendering - SVG: Scalable Vector Graphics | MDN
The text-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering text.
Read more >flutter_svg | Flutter Package - Pub.dev
Draw SVG (and some Android VectorDrawable (XML)) files on a Flutter Widget. Getting Started #. This is a Dart-native rendering library. Issues/PRs will...
Read more >Option to display SVG as "raw text" instead of image - Atlassian
This is due to a "broken image" icon being displayed for certain SVG files that have been pushed to the remote repo and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version 2.0.7 released with the changes.
@seekshiva Thanks for merging the PR. Do you know when it will be added to npm? So I can update the version on my side 😄