From 6e906b2738a02a754a8730a10e6ec091612a233b Mon Sep 17 00:00:00 2001 From: linxianxi <904492381@qq.com> Date: Wed, 28 Aug 2024 16:40:38 +0800 Subject: [PATCH 1/2] fix: dynamic sticky --- src/hooks/useSticky.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/useSticky.ts b/src/hooks/useSticky.ts index 3d13575eb..6e41e902f 100644 --- a/src/hooks/useSticky.ts +++ b/src/hooks/useSticky.ts @@ -26,8 +26,9 @@ export default function useSticky( const container = getContainer() || defaultContainer; + const isSticky = !!sticky; + return React.useMemo(() => { - const isSticky = !!sticky; return { isSticky, stickyClassName: isSticky ? `${prefixCls}-sticky-holder` : '', @@ -36,5 +37,5 @@ export default function useSticky( offsetScroll, container, }; - }, [offsetScroll, offsetHeader, offsetSummary, prefixCls, container]); + }, [isSticky, prefixCls, offsetHeader, offsetSummary, offsetScroll, container]); } From 36a401367463c3775d3a0235c77e5c41ca888b8f Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 28 Aug 2024 16:57:47 +0800 Subject: [PATCH 2/2] Update src/hooks/useSticky.ts --- src/hooks/useSticky.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useSticky.ts b/src/hooks/useSticky.ts index 6e41e902f..f85929302 100644 --- a/src/hooks/useSticky.ts +++ b/src/hooks/useSticky.ts @@ -37,5 +37,5 @@ export default function useSticky( offsetScroll, container, }; - }, [isSticky, prefixCls, offsetHeader, offsetSummary, offsetScroll, container]); + }, [isSticky, offsetScroll, offsetHeader, offsetSummary, prefixCls, container]); }