%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/common/components/Modal/components/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/common/components/Modal/components/Body.js |
import React, { useEffect, useRef } from "react"; import PropTypes from "prop-types"; import { StyledBody } from "../Modal.styles"; export function Body({ onHeightChange, ...props }) { const ref = useRef(); useEffect(() => { onHeightChange(ref?.current?.scrollHeight); // eslint-disable-next-line react-hooks/exhaustive-deps }, [ref?.current?.scrollHeight]); return ( <StyledBody ref={ref} {...props}> {props.children} </StyledBody> ); } Body.propTypes = { onHeightChange: PropTypes.func.isRequired, children: PropTypes.node.isRequired, };