I used <Image>
tag to display images in my project, but it's not displaying the svg images on the iOS, so i used <SvgUri>
from the react-native-svg instead of <Image>
, but now if i try to show any images other than svg, it's throwing error. Is there any library to display both svg and non-svg images on iOS & android devices?
Asked
Active
Viewed 661 times
3

Srinath
- 88
- 7
1 Answers
0
https://www.npmjs.com/package/react-native-svg try this
ex -
import * as React from 'react';
import { SvgUri } from 'react-native-svg';
export default () => (
<SvgUri
width="50%"
height="500%"
uri="http://uri/img.svg"
/>
);

LochanaT
- 17
- 5
-
3Yeah, I tried the same, but it's only working for svg images, if i put a jpeg or png url, then it's throwing `TypeError: undefined is not an object (evaluating 'source.length')` – Srinath Aug 27 '20 at 09:15
-
I can't believe it's not asked around as much. But have you found a solution to this @Srinath? How to render both png and svg in a same view component? – sanjeev Feb 02 '23 at 19:28
-
@sanjeev at the end we decided to render two different components for svgs & pngs, we couldn't find any other better solution – Srinath Mar 31 '23 at 04:06