WaitUntilOnPage: respond to window resizing or zooming.
This commit is contained in:
parent
bb8fb038ca
commit
033b03e6e4
1 changed files with 5 additions and 1 deletions
|
@ -62,7 +62,11 @@ export default function WaitUntilOnPage(props: Props) {
|
|||
|
||||
if (ref && ref.current && !shouldRender) {
|
||||
window.addEventListener('scroll', handleDisplayingRef);
|
||||
return () => window.removeEventListener('scroll', handleDisplayingRef);
|
||||
window.addEventListener('resize', handleDisplayingRef);
|
||||
return () => {
|
||||
window.removeEventListener('scroll', handleDisplayingRef);
|
||||
window.removeEventListener('resize', handleDisplayingRef);
|
||||
};
|
||||
}
|
||||
}, [ref, setShouldRender, shouldRender, shouldElementRender]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue