This commit is contained in:
xiangcai 2025-06-04 10:49:28 +08:00 committed by GitHub
commit b62ebfc7f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,6 @@ import * as React from 'react';
import type { JSX } from 'react';
import classNames from 'classnames';
import { get, set } from 'rc-util';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import type { ColProps } from '../grid/col';
import Col from '../grid/col';
@ -96,12 +95,22 @@ const FormItemInput: React.FC<FormItemInputProps & FormItemInputMiscProps> = (pr
const extraRef = React.useRef<HTMLDivElement>(null);
const [extraHeight, setExtraHeight] = React.useState<number>(0);
useLayoutEffect(() => {
if (extra && extraRef.current) {
setExtraHeight(extraRef.current.clientHeight);
} else {
React.useEffect(() => {
if (!extra) {
setExtraHeight(0);
return;
}
const intervalId = setInterval(() => {
if (extraRef.current) {
setExtraHeight(extraRef.current.clientHeight);
}
}, 100);
return () => {
clearInterval(intervalId);
};
}, [extra]);
const inputDom: React.ReactNode = (