Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

correct way of importing *.svg files #100

Open
DeDuckProject opened this issue Sep 19, 2016 · 0 comments
Open

correct way of importing *.svg files #100

DeDuckProject opened this issue Sep 19, 2016 · 0 comments

Comments

@DeDuckProject
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant