Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

<Visa width={20} /> does not scale #96

Open
kopax opened this issue Jun 23, 2020 · 5 comments
Open

<Visa width={20} /> does not scale #96

kopax opened this issue Jun 23, 2020 · 5 comments

Comments

@kopax
Copy link

kopax commented Jun 23, 2020

Hi and thanks for sharing.

I am a package author and also have some experience with svg package made for react.

In a react-native project, I am using <Visa width={20} /> and at my big surprise, those svg does not scale.

For scaling, you need to set width=100% and height=100% from <svg />, the viewBox="0 0 750 471" is enough.

Just because of this, this package became useless and I had to import all those files manually in my projects.

@muffinresearch
Copy link
Owner

What is the Visa component a reference to in your case? Is that the svg or your own component?

@kopax
Copy link
Author

kopax commented Jun 28, 2020

It is svgr that turn it into a react component.

@muffinresearch
Copy link
Owner

muffinresearch commented Jul 1, 2020

Have you tried using --no-dimensions / {dimensions: false} with svgr? Also you might want to check how --expand-props / expandProps is configured.

@kopax
Copy link
Author

kopax commented Jul 1, 2020

No I did not, I might have a look in the future, but I do not always have svgr and I still expect svg to be scalable, I prefer to use the wrapper to set the dimensions.

This is the reason why I always set the dimensions to 100% in my svg.

@MarianAlexandruAlecu
Copy link

I had the same issue and it works (at least on web) with this webpack config:

{
	test: /\.svg$/,
	use: {
		loader: '@svgr/webpack',
		options: {
			dimensions: false,
		},
	},
},

Now I can scale the icons from CSS

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

3 participants