JSPM

  • Created
  • Published
  • Downloads 1336
  • Score
    100M100P100Q122470F
  • License MIT

A React Hooks package for visibility-sensor

Package Exports

  • @rooks/use-visibility-sensor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rooks/use-visibility-sensor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rooks/use-visibility-sensor

Installation

npm install --save @rooks/use-visibility-sensor

Usage


function Demo() {
    const rootNode = useRef(null);
    const { isVisible, visibilityRect } = useVisibilitySensor(rootNode, {
        intervalCheck: false,
        scrollCheck: true,
        resizeCheck: true
    });
    return (
        <div ref={rootNode}>
        <p>
            {isVisible ? "Visible" : isVisible === null ? "Null" : "Not Visible"}
        </p>
        </div>
    );
}

render(<Demo/>)

Visibility sensor hook for React