MCPcopy
hub / github.com/bvaughn/react-window / onScroll

Function onScroll

lib/core/useVirtualizer.ts:175–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173 }
174
175 const onScroll = () => {
176 setIndices((prev) => {
177 const { scrollLeft, scrollTop } = containerElement;
178
179 const scrollOffset = adjustScrollOffsetForRtl({
180 containerElement,
181 direction,
182 isRtl,
183 scrollOffset: direction === "vertical" ? scrollTop : scrollLeft
184 });
185
186 const next = getStartStopIndicesUtil({
187 cachedBounds,
188 containerScrollOffset: scrollOffset,
189 containerSize,
190 itemCount,
191 overscanCount
192 });
193
194 if (shallowCompare(next, prev)) {
195 return prev;
196 }
197
198 return next;
199 });
200 };
201
202 containerElement.addEventListener("scroll", onScroll);
203

Callers

nothing calls this directly

Calls 2

adjustScrollOffsetForRtlFunction · 0.90
shallowCompareFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…