mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-09 11:40:07 +00:00
<Sticky> component should expect a function as a child (#27401)
This commit is contained in:
committed by
Wesley Wigham
parent
1d4e623ccb
commit
6aa9bbdf5c
18
types/react-sticky/index.d.ts
vendored
18
types/react-sticky/index.d.ts
vendored
@@ -1,14 +1,28 @@
|
||||
// Type definitions for react-sticky 6.0
|
||||
// Project: https://github.com/captivationsoftware/react-sticky
|
||||
// Definitions by: Matej Lednicky <http://www.thinkcreatix.com/>, Curtis Warren <https://github.com/curtisw0>
|
||||
// Definitions by: Matej Lednicky <http://www.thinkcreatix.com/>,
|
||||
// Curtis Warren <https://github.com/curtisw0>,
|
||||
// Andrew Hyndman <https://github.com/ajhyndman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export const StickyContainer: React.ComponentClass<React.HTMLAttributes<HTMLDivElement>>;
|
||||
export const StickyContainer: React.ComponentClass<
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>;
|
||||
|
||||
export interface StickyChildArgs {
|
||||
style: React.CSSProperties;
|
||||
isSticky: boolean;
|
||||
wasSticky: boolean;
|
||||
distanceFromTop: number;
|
||||
distanceFromBottom: number;
|
||||
calculatedHeight: number;
|
||||
}
|
||||
|
||||
export interface StickyProps {
|
||||
children: (args: StickyChildArgs) => React.ReactElement<any>;
|
||||
relative?: boolean;
|
||||
isActive?: boolean;
|
||||
className?: string;
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
import { Sticky, StickyContainer } from "react-sticky";
|
||||
import * as React from "react";
|
||||
|
||||
const StickyAllOptions: JSX.Element =
|
||||
const StickyAllOptions: JSX.Element = (
|
||||
<StickyContainer className="sticky-container">
|
||||
<Sticky
|
||||
relative
|
||||
disableHardwareAcceleration
|
||||
isActive={true}
|
||||
className="sticky"
|
||||
style={{}}
|
||||
stickyClassName="sticky"
|
||||
stickyStyle={{}}
|
||||
topOffset={0}
|
||||
bottomOffset={0}
|
||||
onStickyStateChange={(isSticky: boolean): void => undefined}>
|
||||
<div/>
|
||||
relative
|
||||
disableHardwareAcceleration
|
||||
isActive={true}
|
||||
className="sticky"
|
||||
style={{}}
|
||||
stickyClassName="sticky"
|
||||
stickyStyle={{}}
|
||||
topOffset={0}
|
||||
bottomOffset={0}
|
||||
onStickyStateChange={(isSticky: boolean): void => undefined}
|
||||
>
|
||||
{({ style }) => <div style={style} />}
|
||||
</Sticky>
|
||||
</StickyContainer>;
|
||||
</StickyContainer>
|
||||
);
|
||||
|
||||
const StickyNoOptions: JSX.Element =
|
||||
const StickyNoOptions: JSX.Element = (
|
||||
<StickyContainer>
|
||||
<Sticky>
|
||||
<div/>
|
||||
</Sticky>
|
||||
</StickyContainer>;
|
||||
<Sticky>{({ style }) => <div style={style} />}</Sticky>
|
||||
</StickyContainer>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user