zent
Version:
一套前端设计语言和基于React的实现
45 lines (44 loc) • 1.41 kB
TypeScript
import { PureComponent } from 'react';
import { WaypointPosition } from './position';
export interface IWaypointCallbackData {
currentPosition: WaypointPosition;
previousPosition: WaypointPosition;
event: Event | null;
waypointTop: number;
waypointBottom: number;
viewportTop: number;
viewportBottom: number;
}
export interface IWaypointProps {
scrollableAncestor?: HTMLElement | Window;
children?: React.ReactNode;
topOffset?: number | string;
bottomOffset?: number | string;
horizontal?: boolean;
fireOnRapidScroll?: boolean;
onEnter?: (data: IWaypointCallbackData) => void;
onLeave?: (data: IWaypointCallbackData) => void;
onPositionChange?: (data: IWaypointCallbackData) => void;
}
export declare class Waypoint extends PureComponent<IWaypointProps> {
static defaultProps: {
topOffset: number;
bottomOffset: number;
horizontal: boolean;
fireOnRapidScroll: boolean;
};
private refElement;
private cancelOnNextTick;
private scrollEventListenerUnsubscribe;
private resizeEventListenerUnsubscribe;
private scrollableAncestor;
private previousPosition;
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
private findScrollableAncestor;
private handleScroll;
private getBounds;
private getOffset;
render(): JSX.Element;
}