Reader small image

You're reading from  React Native By Example

Product typeBook
Published inApr 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786464750
Edition1st Edition
Languages
Right arrow
Author (1)
Richard Kho
Richard Kho
author image
Richard Kho

Richard Kho is a software engineer living in San Francisco. He taught himself how to code in 2014 and has lived a past life as a photographer and cinematographer. He currently works for Capital One and has taught software engineers at Hack Reactor in the past. Richard is also a technical advisor to Code Chrysalis, an advanced software engineering immersive in Tokyo.
Read more about Richard Kho

Right arrow

Rendering images


To show an image with React Native, we use the Image component. It lets us display images from both local and remote sources. Styles can also be added to an image, the same way you would stylize any other React component.

We will use the following props for our Image components in this chapter:

  • resizeMode: We will use one of the following strings:
    • cover: This scales the image uniformly and maintains its aspect ratio so that both the width and height of the image will be equal to or larger than the view that encapsulates the Image component.
    • contain: This string also scales the image uniformly and maintains its aspect ratio so that both the width and height of the image will be equal to or less than the view that encapsulates the Image component.
    • stretch: This scales the width and height independently and can change the aspect ratio of the source image.
    • repeat: This repeats the image to cover the entire frame of the encapsulating view. This option also keeps the original size...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
React Native By Example
Published in: Apr 2017Publisher: PacktISBN-13: 9781786464750

Author (1)

author image
Richard Kho

Richard Kho is a software engineer living in San Francisco. He taught himself how to code in 2014 and has lived a past life as a photographer and cinematographer. He currently works for Capital One and has taught software engineers at Hack Reactor in the past. Richard is also a technical advisor to Code Chrysalis, an advanced software engineering immersive in Tokyo.
Read more about Richard Kho