can't use svg files with react-native

Viewed 256

i need to show svg files and find react-native-remote-svg package. but i cant find it and not sure how to solve it anyone can help about that?

there is the warning

import {View, Text} from 'react-native';
import Image from 'react-native-remote-svg';

const App = () => {
  return (
    <View>
      <Image
        source={{
          uri:
            'https://example.com/my-https://s3.us-east-2.amazonaws.com/nomics-api/static/images/currencies/btc.svgpic.svg',
        }}
        style={{width: 200, height: 532}}
      />
    </View>
  );
};

export default App; ```



2 Answers

For rendering remote SVG images better way is using https://github.com/react-native-svg/react-native-svg.

For your case:

import * as React from 'react';
import { SvgUri } from 'react-native-svg';

 export default () => (
  <SvgUri
   width="200"
   height="532"
   uri="https://example.com/my-https://s3.us-east-2.amazonaws.com/nomics-api/static/images/currencies/btc.svgpic.svg"
  />
 );
Related