react-lazy-load
Version:
Simple lazy loading component built with react
43 lines (42 loc) • 1.3 kB
TypeScript
import React, { Component, ReactNode, RefObject } from 'react';
declare type Props = {
children: ReactNode;
className?: string;
elementType?: string;
height?: string | number;
offset?: string | number;
threshold?: number;
width?: number | string;
onContentVisible?: () => void;
};
declare type State = {
visible: boolean;
};
export default class LazyLoad extends Component<Props, State> {
static defaultProps: {
elementType: string;
className: string;
offset: number;
threshold: number;
width: null;
onContentVisible: null;
height: null;
};
elementObserver: IntersectionObserver | null;
wrapper: RefObject<Component> | null;
constructor(props: Props);
componentDidMount(): void;
shouldComponentUpdate(_: Props, nextState: State): boolean;
componentWillUnmount(): void;
getEventNode(): any;
lazyLoadHandler: (entries: IntersectionObserverEntry[]) => void;
render(): React.ReactElement<{
className: string;
style: {
height: string | number | undefined;
width: string | number | undefined;
};
ref: React.RefObject<React.Component<{}, {}, any>> | null;
}, string | React.JSXElementConstructor<any>>;
}
export {};