MCPcopy Create free account
hub / github.com/gotify/server / scrollHandler

Function scrollHandler

ui/src/common/ScrollUpButton.tsx:8–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6 const [state, setState] = React.useState({display: 'none', opacity: 0});
7 React.useEffect(() => {
8 const scrollHandler = () => {
9 const currentScrollPos = Math.max(window.pageYOffset - 1000, 0);
10 const opacity = Math.min(currentScrollPos / 1000, 1);
11 const nextState = {display: currentScrollPos > 0 ? 'inherit' : 'none', opacity};
12 if (state.display !== nextState.display || state.opacity !== nextState.opacity) {
13 setState(nextState);
14 }
15 };
16 window.addEventListener('scroll', scrollHandler);
17 return () => window.removeEventListener('scroll', scrollHandler);
18 }, []);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…