MCPcopy
hub / github.com/ankeetmaini/react-infinite-scroll-component / onMove

Function onMove

src/index.tsx:338–364  ·  view source on GitHub ↗
(evt: Event)

Source from the content-addressed store, hash-verified

336 };
337
338 const onMove = (evt: Event) => {
339 if (!draggingRef.current) return;
340
341 if (evt instanceof MouseEvent) {
342 currentYRef.current = evt.pageY;
343 } else if (evt instanceof TouchEvent) {
344 currentYRef.current = evt.touches[0].pageY;
345 }
346
347 // user is scrolling up — ignore
348 if (currentYRef.current < startYRef.current) return;
349
350 const delta = currentYRef.current - startYRef.current;
351
352 // Read via ref — no stale closure risk, no effect re-registration needed
353 if (delta >= pullThresholdRef.current) {
354 setPullToRefreshThresholdBreached(true);
355 }
356
357 // limit drag to 1.5x maxPullDownDistance
358 if (delta > maxPullDownDistanceRef.current * 1.5) return;
359
360 if (infScrollRef.current) {
361 infScrollRef.current.style.overflow = 'visible';
362 infScrollRef.current.style.transform = `translate3d(0px, ${delta}px, 0px)`;
363 }
364 };
365
366 const onEnd = () => {
367 startYRef.current = 0;

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…