MCPcopy Create free account
hub / github.com/caseywebdev/react-list / updateVariableFrame

Method updateVariableFrame

src/react-list.js:342–375  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

340 }
341
342 updateVariableFrame(cb) {
343 if (!this.props.itemSizeGetter) this.cacheSizes();
344
345 const { start, end } = this.getStartAndEnd();
346 const { length, pageSize } = this.props;
347 let space = 0;
348 let from = 0;
349 let size = 0;
350 const maxFrom = length - 1;
351
352 while (from < maxFrom) {
353 const itemSize = this.getSizeOfItem(from);
354 if (itemSize == null || space + itemSize > start) break;
355 space += itemSize;
356 ++from;
357 }
358
359 const maxSize = length - from;
360
361 while (size < maxSize && space < end) {
362 const itemSize = this.getSizeOfItem(from + size);
363 if (itemSize == null) {
364 size = Math.min(size + pageSize, maxSize);
365 break;
366 }
367 space += itemSize;
368 ++size;
369 }
370
371 this.maybeSetState(
372 constrain(this.props, { from, itemsPerRow: 1, size }),
373 cb
374 );
375 }
376
377 updateUniformFrame(cb) {
378 const { itemSize, itemsPerRow } = this.getItemSizeAndItemsPerRow();

Callers 3

updateFrameMethod · 0.95
react-list.jsFile · 0.80
index.jsFile · 0.80

Calls 5

cacheSizesMethod · 0.95
getStartAndEndMethod · 0.95
getSizeOfItemMethod · 0.95
maybeSetStateMethod · 0.95
constrainFunction · 0.70

Tested by

no test coverage detected