UNPKG

1.01 kBTypeScriptView Raw
1import React from 'react';
2import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
3export interface AffixProps {
4 /** Triggered when the specified offset is reached from the top of the window */
5 offsetTop?: number;
6 /** Triggered when the specified offset is reached from the bottom of the window */
7 offsetBottom?: number;
8 style?: React.CSSProperties;
9 /** Callback function triggered when fixed state changes */
10 onChange?: (affixed?: boolean) => void;
11 /** Set the element that Affix needs to listen to its scroll event, the value is a function that returns the corresponding DOM element */
12 target?: () => Window | HTMLElement | null;
13 prefixCls?: string;
14 className?: string;
15 rootClassName?: string;
16 children: React.ReactNode;
17}
18export interface AffixRef {
19 updatePosition: ReturnType<typeof throttleByAnimationFrame>;
20}
21declare const Affix: React.ForwardRefExoticComponent<AffixProps & React.RefAttributes<AffixRef>>;
22export default Affix;