0
votes

I am using hdpi,mdpi,xhdpi,xxhdpi and xxxhdpi in assets folder for react-native android.

But some images work fine and sometimes the same images get resized(size increases and decreases) even after providing fixed height and width.

everything works fine for ios but in case of android the images gets distorted and sometimes does not display.

I have done every effort to resolve this issue but unable to resolve yet.

2
hey, i'm having a similar problem: everything works fine on iOS and all the images are been displayed in the iOS app but they are displayed in the android app even it's the exact same code i'm using for both .. so did you find a solution yet ? - user3521011
yes the solution is to use resizeMode='stretch' and provide height and width accordingly. - Ankush Rishi

2 Answers

1
votes

this guy saved my day! Here's he's blog: https://saumya.github.io/ray/articles/71/.

To display image or local html, set the uri source like this file:///page-to-your-image-or-local-html.

This really solved my problem!

0
votes

I resolved it using:

resizeMode='stretch'

Using this property for Image the images will not get distorted in any case and we can provide height width accordingly.

http://facebook.github.io/react-native/releases/0.43/docs/image.html#resizemode