Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svg file to variable #1525

Closed
schmru opened this issue Feb 2, 2021 · 3 comments
Closed

Svg file to variable #1525

schmru opened this issue Feb 2, 2021 · 3 comments

Comments

@schmru
Copy link

schmru commented Feb 2, 2021

Hello, currently I am loading SVG files wit imports:
import LogoSVG from '../../../assets/general/logo.svg';

Now I am trying to create an image loading function that checks the source ending and recognize if image is SVG or PNG.
For this I would need someway to create SVG in a function instead with an import and return it as a component.
Something like this:
const LogoSVG = require("../../../assets/general/logo.svg");

Is there a possibility?

@anoopjangra90
Copy link

try following to draw local sag files :

import { WithLocalSvg } from 'react-native-svg';

<WithLocalSvg
asset={require("../localAssets/ic_show_pass.svg")}
/>

@grifotv
Copy link

grifotv commented Mar 4, 2021

What is the difference between LocalSvg and WithLocalSvg? I haven't found them in the docs or type definition. #1443

@bohdanprog
Copy link
Member

Hello @schmru,

I believe the issue has already been resolved. If you are still experiencing problems, please feel free to open a new one.
Thank you.

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

No branches or pull requests

4 participants