chowa
Version:
UI component library based on React
57 lines (56 loc) • 1.7 kB
TypeScript
/**
* @license chowa v1.1.3
*
* Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import * as PropTypes from 'prop-types';
export interface ImageProps {
className?: string;
style?: React.CSSProperties;
imgStyle?: React.CSSProperties;
width?: number;
height?: number;
src: string;
timeout?: number;
onLoad?: () => void;
onError?: () => void;
onAbort?: () => void;
figure?: React.ReactNode;
}
export interface ImageState {
loaded: boolean;
failure: boolean;
}
declare class Image extends React.PureComponent<ImageProps, ImageState> {
static propTypes: {
className: PropTypes.Requireable<string>;
style: PropTypes.Requireable<object>;
imgStyle: PropTypes.Requireable<object>;
width: PropTypes.Requireable<number>;
height: PropTypes.Requireable<number>;
src: PropTypes.Validator<string>;
timeout: PropTypes.Requireable<number>;
onError: PropTypes.Requireable<(...args: any[]) => any>;
onAbort: PropTypes.Requireable<(...args: any[]) => any>;
figure: PropTypes.Requireable<PropTypes.ReactNodeLike>;
};
static defaultProps: {
timeout: number;
figure: JSX.Element;
};
private timer;
private img;
constructor(props: ImageProps);
private onImageLoad;
private onImageError;
private onImageAbort;
componentDidMount(): void;
private clearTimer;
componentWillUnmount(): void;
render(): JSX.Element;
}
export default Image;