React Native MantineData display

Image

Responsive image with placeholder

Import: import { Image } from 'react-native-mantine';

Usage

import { Image } from 'react-native-mantine';

<Image
  source={{ uri: 'https://unsplash.it/640/425' }}
  width={150}
  height={150}
  radius="md"
  fit="cover"
  alt="Random landscape"
/>

Props

PropTypeDefaultDescription
source (required)ImageSourcePropTypeImage source
widthnumberImage width
heightnumberImage height
fit'contain' | 'cover' | 'fill' | 'none' | 'scale-down''cover'Image fit
radiusMantineNumberSize0Key of theme.radius or any valid value to set border-radius
placeholderReact.ReactNodePlaceholder to show when image is loading
errorMessagestring'Failed to load image'Error message to show when image fails to load
errorPlaceholderReact.ReactNodeCustom error placeholder
altstringImage alt text for accessibility
onLoad() => voidCalled when image loads
onError(error: NativeSyntheticEvent<ImageErrorEventData>) => voidCalled when image fails to load
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm