react-scrollsense
Version:
A lightweight scroll sensor to solve your react scroll into viewport issues.
42 lines (41 loc) • 2.59 kB
TypeScript
import React from "react";
import { ScrollConnectedComponentProps, ScrollConnectedComponentState, ConnectOptionsType } from '../types';
declare function scrollConnectComponent(Component: React.ComponentType<any>, mapProps: (ScrollSensorEvent: any) => any, options: ConnectOptionsType): {
new (props: 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 extends keyof ScrollConnectedComponentState>(state: ScrollConnectedComponentState | ((prevState: Readonly<ScrollConnectedComponentState>, props: Readonly<ScrollConnectedComponentProps>) => ScrollConnectedComponentState | Pick<ScrollConnectedComponentState, K>) | Pick<ScrollConnectedComponentState, K>, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
readonly props: Readonly<ScrollConnectedComponentProps> & Readonly<{
children?: React.ReactNode;
}>;
state: Readonly<ScrollConnectedComponentState>;
refs: {
[key: string]: React.ReactInstance;
};
shouldComponentUpdate?(nextProps: Readonly<ScrollConnectedComponentProps>, nextState: Readonly<ScrollConnectedComponentState>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<ScrollConnectedComponentProps>, prevState: Readonly<ScrollConnectedComponentState>): any;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<ScrollConnectedComponentProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<ScrollConnectedComponentProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<ScrollConnectedComponentProps>, nextState: Readonly<ScrollConnectedComponentState>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<ScrollConnectedComponentProps>, nextState: Readonly<ScrollConnectedComponentState>, nextContext: any): void;
};
contextType: React.Context<import("./types").NativeScrollContext>;
};
export default scrollConnectComponent;