A component that automatically resizes its children based on its parent element's size.

Type Parameters

  • T extends unknown = object

Hierarchy (View Summary)

Constructors

  • Type Parameters

    • T extends unknown = object

    Returns AutoSizer<T>

Properties

_autoSizer?: null | HTMLElement
_detectElementResize?: DetectElementResize
_parentNode?: HTMLElement
_setRef: (autoSizer: null | HTMLElement) => void

Sets the reference to the autoSizer element.

Type declaration

    • (autoSizer: null | HTMLElement): void
    • Parameters

      • autoSizer: null | HTMLElement

        The autoSizer element or null.

      Returns void

defaultProps: Partial<IAutoSizerProps<any>>

Default properties for the AutoSizer component.

lastHeightRequest: (h: number) => number
lastWidthRequest: (w: number) => number
state: {
    childHeight: number;
    childWidth: number;
    height: number;
    width: number;
}

Represents the state of a component.

Methods

  • Executes after the component has been mounted to the DOM. It sets up the element for resizing and calls the resize event handler.

    Returns void

  • This method is invoked immediately before a component is unmounted and destroyed.

    It removes the resize listener if it exists and the parent node is defined.

    Returns void

  • Renders a container div with specified child parameters and styles.

    Returns Element

    • The rendered container div element.
  • Determines whether the component should update based on the changes in the nextProps and nextState.

    Parameters

    • nextProps: IAutoSizerProps<T>

      The next props that will be received by the component.

    • nextState: State

      The next state that will be set in the component.

    Returns boolean

    • Returns true if the component should update, otherwise false.