diff --git a/crates/yew-hooks/src/hooks/use_infinite_scroll.rs b/crates/yew-hooks/src/hooks/use_infinite_scroll.rs index 2043ea3..eab1f28 100644 --- a/crates/yew-hooks/src/hooks/use_infinite_scroll.rs +++ b/crates/yew-hooks/src/hooks/use_infinite_scroll.rs @@ -65,13 +65,13 @@ where move || { load_more.set(false); }, - 150, + 100, ) }; use_event(node, "scroll", move |e: Event| { let element: Element = e.target_unchecked_into(); - if element.scroll_height() - element.scroll_top() <= element.client_height() { + if element.scroll_height() - element.scroll_top() <= element.client_height() + 100 { load_more.set(true); debounce.run(); } diff --git a/examples/yew-app/src/routes/hooks/use_infinite_scroll.rs b/examples/yew-app/src/routes/hooks/use_infinite_scroll.rs index 043fe03..d9312f7 100644 --- a/examples/yew-app/src/routes/hooks/use_infinite_scroll.rs +++ b/examples/yew-app/src/routes/hooks/use_infinite_scroll.rs @@ -11,7 +11,7 @@ pub fn infinite_scroll() -> Html { let state = state.clone(); use_infinite_scroll(node.clone(), move || { let max = state.current().len() + 1; - let mut more = vec![max, max + 1, max + 2, max + 3, max + 4]; + let mut more = vec![max, max + 1, max + 2, max + 3, max + 4, max + 5, max + 6]; state.append(&mut more); }); }