This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
correct way of importing *.svg files #100
Open
Description
Hi,
I'm using react-art to display SVGs in the following way,
I open the svg file in a text editor and copy its "path" string to a constant in my react-native app.
my icon component render function looks like this:
<Surface width={this.props.size}
height={this.props.size}
style={{backgroundColor: 'rgba(0,0,0,0)'}}>
<Group x={this.props.x} y={this.props.y}>
<Shape d={this.props.path} fill={this.props.fillColor}/>
</Group>
</Surface>
where this.props.path
is the path of the svg.
However, in order to share code with my web react app, I would prefer importing the svg as a file (ie. src="/icon.svg" or so) and not take the string from the file and hard-code it.
Is there a proper way of doing this? Or am I looking at this the wrong way?
Cheers,
Iftach
Metadata
Metadata
Assignees
Labels
No labels