-
-
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
Android applies rounding to rect when stretching with preserveAspectRatio="none" #1057
Comments
Can you try with the latest commit in the develop branch? |
@msand No change, I tried commit |
Can you try 08e82c5 instead? |
At least seems to work fine for me, did you rebuild the native code? |
Btw you'll need to eject from Expo, if you're using that, to build native dependencies. |
Oh, I forgot to rebuild native... Unfortunately it does not compile, I tried both commits and cleaned the project before.
I use React Native 0.59, seems like this is not compatible. |
Oh, I see. That's from having added support for variable fonts and font weight variation axes. I'll try and find some backwards compatible way to get it done. If you want a quick fick, you can remove the weight argument from the getTypeface call and rebuild. |
I have a fix in my code, I just set the width to be really big and scale down the image instead of scaling a small one up. |
I think the latest commit in develop should work fine in 0.59 and earlier, could you try with that? |
I had to clean and rebuild the project and a little trouble with android studio, but in the end it did work out! :) |
Bug
When using
preserveAspectRatio="none"
I can use pixel dimensions which are potentially only 1 pixel in size, but setting awidth={somethingLarger}
should stretch the image ifviewBox
is defined.On iOS and the web it does, but not on android.
Here is an expo that shows the bug:
https://snack.expo.io/@eymaddis/react-native-svg-android-rounding-error
This is what happens on iOS and web:
Android:
Likely related to #1033.
In this recording I used a device with a pixel density of 2, which is likely why it rounds on 0.5. I assume that using a device with a higher pixel density will result in more visible steps.
Environment info
React native info output:
Library version: 9.5.3
Steps To Reproduce
See expo above.
preserveAspectRatio="none"
<Svg />
in order to stretch the image....
Describe what you expected to happen:
Image should be rendered such that it fills the width/height, without rounding.
Reproducible sample code
See https://snack.expo.io/@eymaddis/react-native-svg-android-rounding-error
The text was updated successfully, but these errors were encountered: