index.d.ts 1.0 KB

123456789101112131415161718192021222324
  1. import React from 'react';
  2. import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
  3. export 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. }
  18. export interface AffixRef {
  19. updatePosition: ReturnType<typeof throttleByAnimationFrame>;
  20. }
  21. declare const Affix: React.ForwardRefExoticComponent<AffixProps & {
  22. onTestUpdatePosition?: any;
  23. } & React.RefAttributes<AffixRef>>;
  24. export default Affix;