I'm searching without success information everywhere on the web on how to create an SVG Rect element in React-Native using the react-native-svg feature. What I reached so far is to define some SVG elements in a component and to pass props to the existing SVG Elements like Rect , Circle and so on. But how can I programmatically create a random number of SVG elements and to attach them to the component ? Sadly, it is not specified in the documentation.
Asked
Active
Viewed 479 times
1
-
What do you mean by create an SVG Rect component and Random Number of SVG elements. Can you please elaborate – Ashwin Mothilal Feb 02 '19 at 07:48
-
Exactly what i said..Create for example a Rect element and attach it to the Canvas..in some sorts of For cycles or similiar. – Claudio Ferraro Feb 02 '19 at 21:56
-
Will this repo be useful for you https://github.com/smooth-code/svgr – Ashwin Mothilal Feb 03 '19 at 06:32
1 Answers
0
I could not find anything on the react-native-svg also.
But this post could be helpfull: How to show SVG file on React Native?.
You have to convert the .svg to JSX like is answered there by Ihor Burlachenko, notice that react-native is deferent from react, in react-native you need to use the react-native-svg module to create the svg JSX component

Jose Villalobos
- 539
- 5
- 9