question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image besides `stretch` & `cover` don't work at all on Android

See original GitHub issue

There is already an identical issue for this, however it’s been locked and marked resolved even though it’s clearly not (at least in React-Native@0.57.1) which prevents discussion of that issue there.

I’m not sure whether this is a bug in React-Native or an oversight in the documentations, but resizeModes don’t work on Android except for stretch and cover, which appear to generate identical results in most (all?) cases.

Do we need to update the documentation here to state that certain modes are only supported on iOS, or are these modes supposed to work on Android?

I’ve been working on this for 2 hours and any use of contain or center causes any and all images to fail to render regardless of styling/positioning of the <Image /> and the containing <View />.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dulmandakhcommented, Feb 21, 2019

Did you tried to pass resizeMode as Image prop?

0reactions
Slapboxcommented, Feb 21, 2019

@dulmandakh I did try as both a prop on Image and in the styles. I tried each way using string values for "contain" and "center" as well as {Image.resizeMode.center} and {Image.resizeMode.contain}, which I’d seen referenced online but which are actually undefined

The behavior is always identical – works on iOS, but does not render on Android.

Android - “contain”

image

iOS - “contain”

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - How to make splash screen image cover the screen?
Show activity on this post. Now, I don't want to FILL the space (stretching the image) but to COVER it (as in CSS3...
Read more >
Drawables overview | Android Developers
If the contents don't fit in this region, then the image is stretched to make them fit. The Draw 9-patch tool offers an...
Read more >
The picture looks too big, stretched, does not fit the screen, or ...
The issue may be with the program - The top or bottom of the screen may be covered by banners or tickers when...
Read more >
Responsive images - web.dev
But then the browser might squash or stretch the image to make it fit your ... An object-fit value of cover tells the...
Read more >
Setting Height And Width On Images Is Important Again
Yes, when an image is being shown at full size, without any CSS changing any dimensions, it is useful to resolve the layout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found