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

Wrong resolution for output #291

Closed
vmenekos opened this issue Mar 11, 2020 · 6 comments · Fixed by #414
Closed

Wrong resolution for output #291

vmenekos opened this issue Mar 11, 2020 · 6 comments · Fixed by #414

Comments

@vmenekos
Copy link

Viewshot capture has different size than set in options
Platform android.
iOS working good.

@FrederickEngelhardt
Copy link

Noticed this as well.

@gre
Copy link
Owner

gre commented Mar 29, 2020

Do you have an example? This is clearly explained and documented in readme that the size you provide is in virtual point and not in pixels. It is multiplied by the pixel ratio of the device

@brunowbbs
Copy link

Could you give us an example?

@mickeylam
Copy link

For Android, I think it must not use the "virtual point" for the size in options. Because the Javascript has precision issue.
For example, I want a image 240X240. For now, I have to use 240 / PixelRatio.get() as a value in options.
And the final result will be 239X239, because in Javascript, (240 / 2.75 * 2.75) = 239.99999997
In the RNViewShotModule.java,
Integer width = options.hasKey("width") ? (int)(displayMetrics.density * options.getDouble("width")) : null;
which cause the problem.

@gre
Copy link
Owner

gre commented May 28, 2022

Ok thanks for pointing it out, indeed it seems to be a mistake that a scaleWidth is used in RNViewShotModule.java.

@gre
Copy link
Owner

gre commented May 28, 2022

#414 should fix it. feel free to review. will be in a future release (breaking).

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

Successfully merging a pull request may close this issue.

5 participants