Skip to content

resizeMode cover doesn't scale up images #11820

@etodanik

Description

@etodanik

Description

resizeMode cover is supposed to make the image width and/or height the same size or bigger than the containing view so that the image fully covers the area of the view.

Currently that only happens if the image is too big. A small image is not being rescaled properly.

Reproduction

Testing was done with network images.

Suppose we're trying to display a 200x200 image to cover a 250x250 View. The current logic would only scale the image down if necessary, and since in that case it isn't - it would end up causing the image to have white borders.

Solution

Scale image up if resizeMode is cover and image is smaller than the View size we're trying to fill.

Additional Information

  • React Native version: 0.39
  • Platform: both ios & android

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions