Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Waypoint<S, SS>

Type parameters

  • S

  • SS

Hierarchy

Index

Properties

Private cancelOnNextTick

cancelOnNextTick: ICancelable

Private previousPosition

previousPosition: WaypointPosition = WaypointPosition.Unknown

Private refElement

refElement: MutableRefObject<Element> = React.createRef<Element>()

Private resizeEventListenerUnsubscribe

resizeEventListenerUnsubscribe: () => void

Type declaration

    • (): void
    • Returns void

Private scrollEventListenerUnsubscribe

scrollEventListenerUnsubscribe: () => void

Type declaration

    • (): void
    • Returns void

Private scrollableAncestor

scrollableAncestor: HTMLElement | Window

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<IWaypointProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

  • UNSAFE_componentWillUpdate(nextProps: Readonly<IWaypointProps>, nextState: Readonly<S>, nextContext: any): void

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

componentDidMount

  • componentDidMount(): void

componentDidUpdate

  • componentDidUpdate(): void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<IWaypointProps>, nextContext: any): void

componentWillUnmount

  • componentWillUnmount(): void

Optional componentWillUpdate

  • componentWillUpdate(nextProps: Readonly<IWaypointProps>, nextState: Readonly<S>, nextContext: any): void

Private findScrollableAncestor

  • findScrollableAncestor(): HTMLElement | Window
  • Traverses up the DOM to find an ancestor container which has an overflow style that allows for scrolling.

    Returns HTMLElement | Window

    the closest ancestor element with an overflow style that allows for scrolling. If none is found, the window object is returned as a fallback.

Private getBounds

  • getBounds(): { viewportBottom: number; viewportTop: number; waypointBottom: number; waypointTop: number }
  • Returns { viewportBottom: number; viewportTop: number; waypointBottom: number; waypointTop: number }

    • viewportBottom: number
    • viewportTop: number
    • waypointBottom: number
    • waypointTop: number

Optional getSnapshotBeforeUpdate

  • getSnapshotBeforeUpdate(prevProps: Readonly<IWaypointProps>, prevState: Readonly<S>): SS | null
  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns SS | null

Private handleScroll

  • handleScroll(event: Event | null): void
  • Parameters

    • event: Event | null

      the native scroll event coming from the scrollable ancestor, or resize event coming from the window. Will be undefined if called by a React life cycle method

    Returns void

render

  • render(): Element

Optional shouldComponentUpdate

  • shouldComponentUpdate(nextProps: Readonly<IWaypointProps>, nextState: Readonly<S>, nextContext: any): boolean
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    • nextProps: Readonly<IWaypointProps>
    • nextState: Readonly<S>
    • nextContext: any

    Returns boolean

Object literals

Static defaultProps

defaultProps: object

bottomOffset

bottomOffset: string = "0px"

fireOnRapidScroll

fireOnRapidScroll: boolean = true

horizontal

horizontal: boolean = false

topOffset

topOffset: string = "0px"

Generated using TypeDoc