UNPKG

react-scrollsense

Version:

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

76 lines (75 loc) 5.13 kB
import React from 'react'; export default function withScrollSense(Component: React.ComponentType): { viaCallback: (options: any) => { new (props: any): { isComplete: boolean; isRafAvailable: boolean; config: any; ioRecords: any[]; onIntersection(el: any, fn: any, options: any): any; updateIObservers(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?: React.ReactNode; }>; state: null; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: null, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: 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: React.Context<import("./types").NativeScrollContext>; }; viaProps: (options: any, mapProps: any) => { new (props: import("../types").ScrollConnectedComponentProps): { showTrue: { show: boolean; }; showFalse: { show: boolean; }; ref: React.RefObject<HTMLDivElement>; config: { rootMargin: string | String; }; componentDidMount(): void; componentDidUpdate(prevProps: any): void; render(): JSX.Element; context: any; setState<K_1 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_1>) | Pick<import("../types").ScrollConnectedComponentState, K_1>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly<import("../types").ScrollConnectedComponentProps> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<import("../types").ScrollConnectedComponentState>; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<import("../types").ScrollConnectedComponentProps>, prevState: Readonly<import("../types").ScrollConnectedComponentState>): 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: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<import("../types").ScrollConnectedComponentProps>, nextState: Readonly<import("../types").ScrollConnectedComponentState>, nextContext: any): void; }; contextType: React.Context<import("./types").NativeScrollContext>; }; };