1
0
Fork 0

Experiment delay render items in carousel

This commit is contained in:
Lim Chee Aun 2024-01-02 19:56:54 +08:00
parent 764125e6b9
commit b4d4c61128

View file

@ -714,6 +714,13 @@ function StatusCarousel({ title, class: className, children }) {
// init?.(); // init?.();
// }, []); // }, []);
const [render, setRender] = useState(false);
useEffect(() => {
setTimeout(() => {
setRender(true);
}, 1);
}, []);
return ( return (
<div class={`status-carousel ${className}`}> <div class={`status-carousel ${className}`}>
<header> <header>
@ -757,7 +764,8 @@ function StatusCarousel({ title, class: className, children }) {
startButtonRef.current.disabled = inView; startButtonRef.current.disabled = inView;
}} }}
/> />
{children} {children[0]}
{render && children.slice(1)}
<InView <InView
class="status-carousel-beacon" class="status-carousel-beacon"
onChange={(inView) => { onChange={(inView) => {