diff --git a/types/react-sticky/index.d.ts b/types/react-sticky/index.d.ts index 9dac505d85..86091531e9 100644 --- a/types/react-sticky/index.d.ts +++ b/types/react-sticky/index.d.ts @@ -1,14 +1,28 @@ // Type definitions for react-sticky 6.0 // Project: https://github.com/captivationsoftware/react-sticky -// Definitions by: Matej Lednicky , Curtis Warren +// Definitions by: Matej Lednicky , +// Curtis Warren , +// Andrew Hyndman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 import * as React from "react"; -export const StickyContainer: React.ComponentClass>; +export const StickyContainer: React.ComponentClass< + React.HTMLAttributes +>; + +export interface StickyChildArgs { + style: React.CSSProperties; + isSticky: boolean; + wasSticky: boolean; + distanceFromTop: number; + distanceFromBottom: number; + calculatedHeight: number; +} export interface StickyProps { + children: (args: StickyChildArgs) => React.ReactElement; relative?: boolean; isActive?: boolean; className?: string; diff --git a/types/react-sticky/react-sticky-tests.tsx b/types/react-sticky/react-sticky-tests.tsx index 8284add89a..085bfe786c 100644 --- a/types/react-sticky/react-sticky-tests.tsx +++ b/types/react-sticky/react-sticky-tests.tsx @@ -1,26 +1,27 @@ import { Sticky, StickyContainer } from "react-sticky"; import * as React from "react"; -const StickyAllOptions: JSX.Element = +const StickyAllOptions: JSX.Element = ( undefined}> -
+ relative + disableHardwareAcceleration + isActive={true} + className="sticky" + style={{}} + stickyClassName="sticky" + stickyStyle={{}} + topOffset={0} + bottomOffset={0} + onStickyStateChange={(isSticky: boolean): void => undefined} + > + {({ style }) =>
} - ; + +); -const StickyNoOptions: JSX.Element = +const StickyNoOptions: JSX.Element = ( - -
- - ; + {({ style }) =>
} + +);