Image

This component displays an image, which can come from a local source or from the network. It supports JPEG, GIF and PNG formats.

Styles

  • Flexbox Styles

  • View Styles

  • Transform Styles

Props

Name

Type

Description

accessibilityLabel

string

  • Alternate text to display if the image cannot be loaded or by screen readers

headers

{[headerName: string]: string}

  • HTTP headers to include when fetching the URL

onError

(err?: Error) => void

  • Called when an error occurs that prevents the image from loading

onLoad

(size: Dimensions) => void

  • Called when the image successfully loads

resizeMethod

'auto' | 'resize' | 'scale'

  • Android-specific resize property

resizeMode

'stretch' | 'contain' | 'cover' | 'auto' | 'repeat'

  • Determines how to resize the image if its natural size does not match the size of the container

  • Note: In Web version, 'auto' doesn't scale down image if width/height smaller than the original image size

source

string

  • URL to image

style

ImageStyleRuleSet | ImageStyleRuleSet[ ]

  • See below for supported styles

testId

string

  • ID that can be used to identify the instantiated element for testing purposes

title

string

  • Tooltip for image

Last updated