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

Method render

src/react-list.js:491–524  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

489 }
490
491 render() {
492 const { axis, getListStyle, length, type, useTranslate3d } = this.props;
493 const { from, itemsPerRow } = this.state;
494
495 const items = this.renderItems();
496 if (type === 'simple') return items;
497
498 const style = { position: 'relative' };
499 const cache = {};
500 const bottom = Math.ceil(length / itemsPerRow) * itemsPerRow;
501 const size = this.getSpaceBefore(bottom, cache);
502 if (size) {
503 style[SIZE_KEYS[axis]] = size;
504 if (axis === 'x') style.overflowX = 'hidden';
505 }
506 const offset = this.getSpaceBefore(from, cache);
507 const x = axis === 'x' ? offset : 0;
508 const y = axis === 'y' ? offset : 0;
509 const transform = useTranslate3d
510 ? `translate3d(${x}px, ${y}px, 0)`
511 : `translate(${x}px, ${y}px)`;
512 const listStyle = getListStyle
513 ? getListStyle({ x, y })
514 : {
515 msTransform: transform,
516 WebkitTransform: transform,
517 transform
518 };
519 return (
520 <div style={style} ref={c => (this.el = c)}>
521 <div style={listStyle}>{items}</div>
522 </div>
523 );
524 }
525}

Callers 2

updateClassComponentFunction · 0.80
index.jsFile · 0.80

Calls 2

renderItemsMethod · 0.95
getSpaceBeforeMethod · 0.95

Tested by

no test coverage detected