Is it possible to resize an SVG?
See original GitHub issueAs in the title, by reading the README.md I’m not able to figure out if there is a simple way to have the SVG resized without having to manually change the various parameters.
The use case is this: I want to have an SVG image as a component (let’s call it Draw
), and a screen component in which I want to import it (let’s call it App
). But I can’t know for sure the size of the View in which my Draw
element will be placed, but I’d like to see the full image resized - the same way an Image
would be resized.
Is there a simple way to handle it?
The only “workaround” I managed to think of it the one I’ve implemented in this demo - basically, I ask the View component that will contain the SVG its dimensions and set them as the width and height of the various elements. But it seems a bit too complex, and error-prone.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Not sure what you want to accomplish but you can use viewBox to resize svg component
https://rnplay.org/apps/CdJI3w
circle will be 50 units because element width/height is two times bigger than viewBox width/height
Oh you are right - anyway thanks for the help provided 😃