UNPKG

react-scrollsense

Version:

A lightweight scroll sensor to solve your react scroll into viewport issues.

98 lines (97 loc) 7.49 kB
/// <reference types="react" /> import { ConnectOptionsType } from '../types'; export default function withScrollSense(Component: any): { viaCallback: (options: ConnectOptionsType, useMultipleIO?: boolean) => { new (props: any): { isComplete: boolean; isRafAvailable: boolean; config: any; ioRecords: any[]; onIntersection(el: HTMLElement, fn: (ScrollSensorEvent: any, HTMLElement: any, number?: any) => void, options: ConnectOptionsType): any; updateIObservers(threshold: any, root: any, rootMargin: any): void; componentDidUpdate(prevProps: any): void; componentDidMount(): void; render(): JSX.Element; context: any; setState<K extends never>(state: ((prevState: null, props: Readonly<import("../types").ScrollConnectedComponentProps>) => Pick<null, K>) | Pick<null, K>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly<import("../types").ScrollConnectedComponentProps> & Readonly<{ children?: import("react").ReactNode; }>; state: null; refs: { [key: string]: import("react").ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: null): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): void; }; contextType: import("react").Context<import("./types").IOScrollContext>; } | { new (props: any): { isRafAvailable: boolean; isComplete: boolean; onIntersection(el: any, fn: any): any; componentDidMount(): void; render(): JSX.Element; context: any; setState<K_1 extends never>(state: ((prevState: null, props: Readonly<import("../types").ScrollConnectedComponentProps>) => Pick<null, K_1>) | Pick<null, K_1>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly<import("../types").ScrollConnectedComponentProps> & Readonly<{ children?: import("react").ReactNode; }>; state: null; refs: { [key: string]: import("react").ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: null): any; componentDidUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: null, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): void; }; contextType: import("react").Context<import("./types").IOScrollContext>; }; viaProps: (options: ConnectOptionsType, mapProps: (ScrollSensorEvent: any) => any, useMultipleIO?: boolean) => { new (props: any): { ref: import("react").RefObject<HTMLDivElement>; componentDidMount(): void; render(): JSX.Element; context: any; setState<K_2 extends keyof import("../types").ScrollConnectedComponentState>(state: import("../types").ScrollConnectedComponentState | ((prevState: Readonly<import("../types").ScrollConnectedComponentState>, props: Readonly<import("../types").ScrollConnectedComponentProps>) => import("../types").ScrollConnectedComponentState | Pick<import("../types").ScrollConnectedComponentState, K_2>) | Pick<import("../types").ScrollConnectedComponentState, K_2>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly<import("../types").ScrollConnectedComponentProps> & Readonly<{ children?: import("react").ReactNode; }>; state: Readonly<import("../types").ScrollConnectedComponentState>; refs: { [key: string]: import("react").ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: Readonly<import("../types").ScrollConnectedComponentState>): any; componentDidUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: Readonly<import("../types").ScrollConnectedComponentState>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): void; }; contextType: import("react").Context<import("./types").IOScrollContext>; }; };