-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 set Height to auto #1429
Comments
@msand , could I bother you to take a glance at this? Should be a common enough occurance. Maybe I am missing something. |
I ran into the same issue. I don't have a proper fix to it, but you can achieve what you want with a simple calculation:
Hope this helps until a proper fix is introduced. |
Thanks for confirming @FabioReact . This requirement is so basic that I thought that it should be implemented and I could not figure out how to do it... |
@FabioReact what if the image comes from a remote source and can have any widht/height ratio? I think the uri version of this libraries SVG can read the size from the XML stream. |
Hi, |
I have been breaking my head over trying to have height set at auto, and would like some help with this regards. This would usually be done by not specifying any height in a View, but for SVG component, this does not seem to work.
Below is what I have tried :
Here, the SVG occupies the whole screen
Here, the SVG's height reduces to 200. Note that there is padding at the top too, and bottom contains same amount of padding.
The same thing when tried with something like
height={null}
does not show the SVG itself.Desired Behaviour : set width to '100%' (doable), while the height is
auto
adjusted based on the SVG.The SVG Component :
I have tried doing this with both converting it into a component with SVGR Playground
AND also using the SVG directly by loading it using SvgXML as below:
where svg contains the SVG's content.
With regards to the SVG, it does not contain any extra padding, and I don't think the SVG is the problem since it works just fine when height is set.
The text was updated successfully, but these errors were encountered: