Skip to main content

IMGElementStateSuccess

export
interface IMGElementStateSuccess {
  alt?: string;
  altColor?: string;
  containerStyle: ViewStyle;
  dimensions: ImageDimensions;
  imageStyle: ImageStyle;
  onError: (error: Error) => void;
  source: ImageURISource;
  type: "success";
}

State when the image has been successfully loaded.

Fields#

alt#

optional
alt?: string;

Alt text extract from alt attribute.

altColor#

optional
altColor?: string;

Alt color, defaults to color for this ​TNode.

containerStyle#

required
containerStyle: ViewStyle;

Styles of the container.

dimensions#

required
dimensions: ImageDimensions;

Physical dimensions of the image

imageStyle#

required
imageStyle: ImageStyle;

Image-only style extracted from IMGElement.style prop.

onError#

required
onError: (error: Error) => void;

This callback should be passed down to the underlying image component.

Remarks

Quite often, the image won't be pre-fetched because its print dimensions can be determined immediately. For example, when both width and height are provide as attributes. So the first state s0 of this state machine can be "success", and the second state s1 be "error".

source#

required
source: ImageURISource;

The source to paint.

type#

required
type: "success";