import { ImageBackground } from '@uhg-abyss/mobile';Usage
A common feature request from developers familiar with the web is a background-image. To handle this use case, you can use the
ImageBackground component, which has the same props as Image, and add whatever children to it you would like to layer on top of it.
The ImageBackground component is a specialized container that displays an image as the background of a view.
This component is an enhancement of React Native's core ImageBackground, tailored to integrate seamlessly with our design system.
Example
Resize Mode
The resizeMode prop controls how the image is resized within the bounds set by the style prop. It can be one of the following values:
ImageBackground Classes
| Class Name | Description |
|---|---|
| abyss-image-background-root | ImageBackground root element |
ImageBackground Props
Extends React Native - ImageBackground props.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
capInsets | Insets | undefined | - | - | When the image is resized, the corners of the size specified by capInsets will stay a fixed size, but the center content and borders of the image will be stretched. This is useful for creating resizable rounded buttons, shadows, and other resizable assets. More info in the [official Apple documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/index.html#//apple_ref/occ/instm/UIImage/resizableImageWithCapInsets). |
height | Abyss.Size | undefined | - | - | Height of the image component. |
imageStyle | Abyss.Style<"Image"> | - | - | These styles will be applied to the Image component which is nested inside ImageBackground |
style | Abyss.Style<"ImageBackground"> | - | - | ImageBackground style properties with Abyss token mapping |
tintColor | Abyss.Color | undefined | - | - | Changes the color of all non-transparent pixels to the tintColor. |
width | Abyss.Size | undefined | - | - | Width of the image component. |