fmf mfmf
fmf mfmf

Reputation: 1

SVG as a background image in React Native

I am trying to add svg as a background image and i am using a React-Native-Svg to generate my svg and I've been trying to add it onto

<ImageBackground source{{'<svg>...'}} />

But I cant manage to get a anywhere with it

If anybody could give pointers i would really appreciate it

Upvotes: 0

Views: 2898

Answers (1)

Camilo Saenz
Camilo Saenz

Reputation: 11

As the documentation says you need to import the .svg file inside de Component:

import Logo from './logo.svg';

You can then use your image as a component:

<Logo width={120} height={40} />

From: https://github.com/react-native-community/react-native-svg#use-with-svg-files

Upvotes: 1

Related Questions