From 945b18b05361378d4104049539ce942abe3e40d5 Mon Sep 17 00:00:00 2001 From: Hailey Date: Sat, 4 May 2024 20:43:27 -0700 Subject: [PATCH] fix `rootMargin` --- src/view/com/util/List.web.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/view/com/util/List.web.tsx b/src/view/com/util/List.web.tsx index 1453dd3149..02564e1e18 100644 --- a/src/view/com/util/List.web.tsx +++ b/src/view/com/util/List.web.tsx @@ -213,8 +213,8 @@ function ListImpl( ))} {onEndReached && ( )} {footer} @@ -276,10 +276,12 @@ Row = React.memo(Row) let Visibility = ({ topMargin = '0px', + bottomMargin = '0px', onVisibleChange, style, }: { topMargin?: string + bottomMargin?: string onVisibleChange: (isVisible: boolean) => void style?: ViewProps['style'] }): React.ReactNode => { @@ -301,14 +303,14 @@ let Visibility = ({ React.useEffect(() => { const observer = new IntersectionObserver(handleIntersection, { - rootMargin: `${topMargin} 0px 0px 0px`, + rootMargin: `${topMargin} 0px ${bottomMargin} 0px`, }) const tail: Element | null = tailRef.current! observer.observe(tail) return () => { observer.unobserve(tail) } - }, [handleIntersection, topMargin]) + }, [bottomMargin, handleIntersection, topMargin]) return (