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

Aspect Ratio Ignored in iOS #39

Open
drewcovi opened this issue Nov 19, 2018 · 6 comments
Open

Aspect Ratio Ignored in iOS #39

drewcovi opened this issue Nov 19, 2018 · 6 comments

Comments

@drewcovi
Copy link

Is there any way to enforce aspect ratio in iOS? At present, the nativescript.svg stretches to fill the width of the container and height, completely ignoring both viewbox and preserveaspectratio parameters.

@drewcovi
Copy link
Author

drewcovi commented Dec 4, 2018

@victorsosa any idea what might be going on here? should this plugin get updated to create a container and manually respect the preserveAspectRatio settings?

@victorsosa
Copy link
Contributor

victorsosa commented Dec 4, 2018

@drewcovi no idea; viewbox and preserveaspectratio parameters? please show me where are those?? or how to use them

@drewcovi
Copy link
Author

drewcovi commented Dec 4, 2018

They’re properties on any given svg element including the Nativescript svg included in this plugin. They’re used to ensure proportional scaling. I’ll hunt down an example of how this was done in React Native land.

@victorsosa
Copy link
Contributor

the nativescript.svg stretches to fill the width of the container and height

that's true

@drewcovi
Copy link
Author

drewcovi commented Dec 4, 2018

@victorsosa darn. it looks like the most routinely maintained library for React Native doesn't use SVGKit, but the approach is still the same. I believe in nativescript one could simply create a parent view that handles centering/scaling.

This is a consequence of SVGKFastImageView (which if it inherits some of imageview I believe defaults to scaling regardless of aspect ratio).

https://github.com/react-native-community/react-native-svg/blob/c415dbd6ae77834f7ea465eee63f0207828e5104/ios/Utils/RNSVGViewBox.m

https://github.com/react-native-community/react-native-svg/blob/f38b44098cfe24b6752e763042f48447ae365ab8/lib/extract/extractViewBox.js

@drewcovi
Copy link
Author

drewcovi commented Dec 4, 2018

@victorsosa seems this is a known issue in SVGKit SVGKit/SVGKit#261

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

2 participants