Import
Basic Usage
Props
Source Props
ImageSource
required
The image source (either a remote URL or a local file resource). This prop can also contain several remote URLs, specified together with their width and height. The native side will then choose the best URI to display based on the measured size of the image container.Supported formats: png, jpg, jpeg, bmp, gif, webp (Android only), psd (iOS only)
string
A string representing the resource identifier for the image. Similar to src from HTML.
string
Similar to srcset from HTML. Specifies multiple image sources for different display densities.
Display Props
'cover' | 'contain' | 'stretch' | 'repeat' | 'center'
Determines how to resize the image when the frame doesn’t match the raw image dimensions.
cover- Scale the image uniformly (maintain aspect ratio) so that both dimensions will be equal to or larger than the corresponding dimension of the viewcontain- Scale the image uniformly so that both dimensions will be equal to or less than the corresponding dimension of the viewstretch- Scale width and height independently, may change the aspect ratio of the srcrepeat- Repeat the image to cover the frame of the view (iOS only)center- Scale the image down so that it is completely visible, if bigger than the view area
number
Width of the image component.
number
Height of the image component.
ImageStyle
Styles to apply to the image.
Visual Props
number
The blur radius of the blur filter added to the image.
color
Changes the color of all the non-transparent pixels to the tintColor.
Accessibility Props
boolean
When true, indicates the image is an accessibility element.
string
The text that’s read by the screen reader when the user interacts with the image.
string
Alias for accessibilityLabel. The text that’s read by the screen reader when the user interacts with the image.
string
Alias for accessibilityLabel.
Network Props
'anonymous' | 'use-credentials'
Adds the CORS related header to the request. Similar to crossorigin from HTML.
string
A string indicating which referrer to use when fetching the resource. Similar to referrerpolicy from HTML.Options: ‘no-referrer’, ‘no-referrer-when-downgrade’, ‘origin’, ‘origin-when-cross-origin’, ‘same-origin’, ‘strict-origin’, ‘strict-origin-when-cross-origin’, ‘unsafe-url’
Event Handlers
(event: ImageLoadEvent) => void
Invoked when load completes successfully. Event data includes the image source dimensions and URI.
() => void
Invoked on load start.
() => void
Invoked when load either succeeds or fails.
(event: ImageErrorEvent) => void
Invoked on load error with
{nativeEvent: {error}}.(event: LayoutEvent) => void
Invoked on mount and layout changes with
{nativeEvent: { layout: {x, y, width, height}}}.Identification Props
string
A unique identifier for this element to be used in UI Automation testing scripts.
Platform-Specific Props
- iOS
- Android
ImageSource
A static image to display while loading the image source.
() => void
Invoked when a partial load of the image is complete.
(event: ImageProgressEvent) => void
Invoked on download progress with
{nativeEvent: {loaded, total}}.Insets
When the image is resized, the corners specified by capInsets will stay a fixed size, but the center content and borders will be stretched.