fix non render of Issues

This commit is contained in:
rahulramesha 2024-03-26 16:52:00 +05:30
parent 834bf27231
commit 236f0c544a

View File

@ -24,7 +24,7 @@ const RenderIfVisible: React.FC<Props> = (props) => {
as = "div",
children,
classNames = "",
alwaysRender = false, //render the children even if it is not visble in root
alwaysRender = false, //render the children even if it is not visible in root
placeholderChildren = null, //placeholder children
pauseHeightUpdateWhileRendering = false, //while this is true the height of the blocks are maintained
changingReference, //This is to force render when this reference is changed
@ -48,7 +48,7 @@ const RenderIfVisible: React.FC<Props> = (props) => {
// } else {
// setShouldVisible(entries[0].isIntersecting);
// }
setShouldVisible(entries[0].isIntersecting);
setShouldVisible(entries[entries.length - 1].isIntersecting);
},
{
root: root?.current,
@ -63,7 +63,7 @@ const RenderIfVisible: React.FC<Props> = (props) => {
}
};
}
}, [intersectionRef, children, changingReference, root, verticalOffset, horizontalOffset]);
}, [intersectionRef, children, root, verticalOffset, horizontalOffset]);
//Set height after render
useEffect(() => {