Image

Image, a React Native component for iOS, Android and web: An image with a loading state, alt text and a failure fallback.

Usage

import { Image } from './components/ui/image';
import { Stack } from './components/ui/stack';

const photo = require('./assets/sample.png');

export default function Example() {
  return (
    <Stack direction="horizontal" gap={3} wrap>
      <Image source={photo} alt="A generated landscape" aspectRatio={1.6} style={{ width: 280 }} />
      <Image source={null} alt="No source, so this shows the fallback" aspectRatio={1.6} style={{ width: 280 }} />
    </Stack>
  );
}

Props

PropTypeDefaultDescription
sourceImageSourcePropType | string | nullURL or a bundled `require()`. A missing source shows the fallback.
altstringWhat the image shows. Use `""` for purely decorative images, which screen readers then skip.
aspectRationumber
radius'none' | 'sm' | 'md' | 'lg' | 'full''md'
fallbackReactNodeShown when the source is missing or fails. Defaults to a muted box with the alt text, or a small image mark when the image is decorative.
styleStyleProp<ViewStyle>