diff --git a/packages/components/popup/Popup.tsx b/packages/components/popup/Popup.tsx index 998a631a66..4c27171e38 100644 --- a/packages/components/popup/Popup.tsx +++ b/packages/components/popup/Popup.tsx @@ -20,6 +20,9 @@ import { getTransitionParams } from './utils/transition'; import type { PopupInstanceFunctions, TdPopupProps } from './type'; +/** + * @internal + */ export interface PopupProps extends TdPopupProps { // 是否触发展开收起动画,内部下拉式组件使用 expandAnimation?: boolean; @@ -210,14 +213,14 @@ const Popup = forwardRef((originalProps, ref // 下拉展开时更新内部滚动条和箭头位置 useEffect(() => { - if (visible && popupElement) { - updateScrollTop?.(contentRef.current); + if (visible && popupElement && contentRef.current) { requestAnimationFrame(() => { + updateScrollTop?.(contentRef.current); updateArrowPosition(); }); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [visible, popupElement, updateScrollTop]); + }, [visible, content, popupElement]); function handleExited() { setIsOverlayHover(false); diff --git a/packages/tdesign-react/.changelog/pr-4062.md b/packages/tdesign-react/.changelog/pr-4062.md new file mode 100644 index 0000000000..45d99f3876 --- /dev/null +++ b/packages/tdesign-react/.changelog/pr-4062.md @@ -0,0 +1,7 @@ +--- +pr_number: 4062 +contributor: RylanBot +--- + +- fix(Cascader): 修复在弹出层可见期间,滚动位置被意外更新的问题 @RylanBot ([#4062](https://github.com/Tencent/tdesign-react/pull/4062)) +- fix(Popup): 修复 `content` 动态修改时,箭头位置不稳定的问题 @RylanBot ([#4062](https://github.com/Tencent/tdesign-react/pull/4062)) \ No newline at end of file