UNPKG

@mornya/react-image-libs

Version:
28 lines (27 loc) 843 B
import React from 'react'; export declare function usePrev<T = any | undefined>(value: T | undefined): T | undefined; type LazyImageLoadState = '' | 'prepare' | 'loading' | 'loaded' | 'error' | 'halt'; export type LazyImageProps = { url: string; title?: string; beforeLoad?: JSXElement | null; loading?: JSXElement | null; loadingImageUrl?: string; error?: JSXElement | null; errorImageUrl?: string; tabIndex?: number; className?: string; style?: React.CSSProperties; onLoaded?(payload: LazyImagePayload): void; onError?(url: string): void; }; export type LazyImagePayload = { url: string; width: number; height: number; loadState: LazyImageLoadState; }; export declare function useLazyImage(imageProps: LazyImageProps): LazyImagePayload & { loadImage(): void; }; export {};