Skip to content

Commit 9eb36a5

Browse files
committed
chore: update
1 parent 32f0947 commit 9eb36a5

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

src/stickyScrollBar.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ const StickyScrollBar: React.ForwardRefRenderFunction<unknown, StickyScrollBarPr
4343
});
4444
const [isActive, setActive] = React.useState(false);
4545
const rafRef = React.useRef<number | null>(null);
46-
// 记录上一次的 container
47-
const lastContainerRef = React.useRef<HTMLElement | Window>();
4846
// 记录上一次的 scrollParents
4947
const lastScrollParentsRef = React.useRef<(HTMLElement | SVGElement)[]>([]);
5048

@@ -175,12 +173,6 @@ const StickyScrollBar: React.ForwardRefRenderFunction<unknown, StickyScrollBarPr
175173
window.addEventListener('scroll', checkScrollBarVisible, false);
176174
container.addEventListener('scroll', checkScrollBarVisible, false);
177175

178-
// 清理上一次 container 的事件监听
179-
if (lastContainerRef.current && lastContainerRef.current !== container) {
180-
lastContainerRef.current.removeEventListener('scroll', checkScrollBarVisible);
181-
}
182-
lastContainerRef.current = container;
183-
184176
return () => {
185177
scrollParents.forEach(p => p.removeEventListener('scroll', checkScrollBarVisible));
186178
window.removeEventListener('resize', checkScrollBarVisible);

0 commit comments

Comments
 (0)