Skip to main content

UseIMGElementStateProps

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

Props for ​useIMGElementState hook.

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.

source#

required
source: ImageURISource;

The source to paint.

style#

optional
style?: StyleProp<ImageStyle>;

The style for this image.

width#

optional
width?: string | number;

The value of the width attribute.