import _extends from "@babel/runtime/helpers/extends";
import React, { forwardRef, useCallback, useEffect } from 'react';
import { useInView } from 'react-intersection-observer';
var ViewSection = /*#__PURE__*/forwardRef(function (props, forward) {
  var onInViewChange = props.onInViewChange;

  var _useInView = useInView({
    root: null
  }),
      intersectionRef = _useInView.ref,
      inView = _useInView.inView;

  var ref = useCallback(function (node) {
    forward(node);
    intersectionRef(node);
  }, [intersectionRef, forward]);
  useEffect(function () {
    onInViewChange(inView);
  }, [onInViewChange, inView]);
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
    ref: ref
  }));
});
ViewSection.displayName = 'ViewSection';
export default ViewSection;
//# sourceMappingURL=ViewSection.js.map
