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

Method updateSimpleFrame

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

Source from the content-addressed store, hash-verified

318 }
319
320 updateSimpleFrame(cb) {
321 const { end } = this.getStartAndEnd();
322 const itemEls = this.items.children;
323 let elEnd = 0;
324
325 if (itemEls.length) {
326 const { axis } = this.props;
327 const firstItemEl = itemEls[0];
328 const lastItemEl = itemEls[itemEls.length - 1];
329 elEnd =
330 this.getOffset(lastItemEl) +
331 lastItemEl[OFFSET_SIZE_KEYS[axis]] -
332 this.getOffset(firstItemEl);
333 }
334
335 if (elEnd > end) return cb();
336
337 const { pageSize, length } = this.props;
338 const size = Math.min(this.state.size + pageSize, length);
339 this.maybeSetState({ size }, cb);
340 }
341
342 updateVariableFrame(cb) {
343 if (!this.props.itemSizeGetter) this.cacheSizes();

Callers 3

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

Calls 3

getStartAndEndMethod · 0.95
getOffsetMethod · 0.95
maybeSetStateMethod · 0.95

Tested by

no test coverage detected