@jdcfe/yep-react
Version:
一套移动端的React组件库
53 lines (52 loc) • 1.68 kB
TypeScript
import * as React from 'react';
import * as PropTypes from 'prop-types';
import StickyContainer from './StickyContainer';
export interface StickyProps {
topOffset: number;
bottomOffset: number;
relative?: boolean;
children: (props: any) => any;
disableCompensation: boolean;
disableHardwareAcceleration: boolean;
}
interface State {
isSticky: boolean;
wasSticky: boolean;
style: React.CSSProperties;
calculatedHeight: number;
distanceFromTop?: number;
distanceFromBottom?: number;
}
/**
* @deprecated please use CSS: position: sticky; top: 0;
*/
declare class Sticky extends React.PureComponent<StickyProps, State> {
static StickyContainer: typeof StickyContainer;
static defaultProps: {
relative: boolean;
topOffset: number;
bottomOffset: number;
disableCompensation: boolean;
disableHardwareAcceleration: boolean;
};
static contextTypes: {
subscribe: PropTypes.Requireable<(...args: any[]) => any>;
unsubscribe: PropTypes.Requireable<(...args: any[]) => any>;
getParent: PropTypes.Requireable<(...args: any[]) => any>;
};
placeholder: any;
content: any;
constructor(props: StickyProps);
componentWillMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
handleContainerEvent({ distanceFromTop, distanceFromBottom, eventSource }: {
distanceFromTop: any;
distanceFromBottom: any;
eventSource: any;
}): void;
createPlaceholderRef(placeholder: HTMLDivElement): void;
createContentRef(content: HTMLDivElement): void;
render(): JSX.Element;
}
export default Sticky;