Skip to main content

IMGElementProps

export
interface IMGElementProps {
  alt?: string;
  altColor?: string;
  cachedNaturalDimensions?: ImageDimensions;
  computeMaxWidth?: (contentWidth: number) => number;
  contentWidth?: number;
  enableExperimentalPercentWidth?: boolean;
  height?: string | number;
  initialDimensions?: ImageDimensions;
  objectFit?: ObjectFit;
  onPress?: null | (event: GestureResponderEvent) => void;
  source: ImageURISource;
  style?: StyleProp<ImageStyle>;
  testID?: string;
  width?: string | number;
}

Props for the ​IMGElement component.

Fields#

alt#

optional
alt?: string;

Alt text extract from alt attribute.

altColor#

optional
altColor?: string;

Alt color, defaults to color for this ​TNode.

cachedNaturalDimensions#

optional
cachedNaturalDimensions?: ImageDimensions;

When the natural ("physical") dimensions for this image are accessible a priori, these should be passed. It will save some API calls and filesytem access via React Native Image.getSize.

computeMaxWidth#

optional
computeMaxWidth?: (contentWidth: number) => number;

When provided, the print image will have a max width depending on the contentWidth prop.

contentWidth#

optional
contentWidth?: number;

The contentWidth from the ​RenderHTMLProps.

enableExperimentalPercentWidth#

optional
enableExperimentalPercentWidth?: boolean;

Allow experimental percent width for the print dimensions computation. The percent will be relative to contentWidth

height#

optional
height?: string | number;

The value of the height attribute.

initialDimensions#

optional
initialDimensions?: ImageDimensions;

Rendered dimensions prior to retrieving natural dimensions of the image.

objectFit#

optional
objectFit?: ObjectFit;

The value of the object-fit CSS property.

onPress#

optional
onPress?: null | (event: GestureResponderEvent) => void;

A callback triggered on press.

source#

required
source: ImageURISource;

The source to paint.

style#

optional
style?: StyleProp<ImageStyle>;

The style for this image.

testID#

optional
testID?: string;

width#

optional
width?: string | number;

The value of the width attribute.