(index)
| 426 | } |
| 427 | |
| 428 | getSizeOfItem(index) { |
| 429 | const { cache, items } = this; |
| 430 | const { axis, itemSizeGetter, itemSizeEstimator, type } = this.props; |
| 431 | const { from, itemSize, size } = this.state; |
| 432 | |
| 433 | // Try the static itemSize. |
| 434 | if (itemSize) return itemSize; |
| 435 | |
| 436 | // Try the itemSizeGetter. |
| 437 | if (itemSizeGetter) return itemSizeGetter(index); |
| 438 | |
| 439 | // Try the cache. |
| 440 | if (index in cache) return cache[index]; |
| 441 | |
| 442 | // Try the DOM. |
| 443 | if (type === 'simple' && index >= from && index < from + size && items) { |
| 444 | const itemEl = items.children[index - from]; |
| 445 | if (itemEl) return itemEl[OFFSET_SIZE_KEYS[axis]]; |
| 446 | } |
| 447 | |
| 448 | // Try the itemSizeEstimator. |
| 449 | if (itemSizeEstimator) return itemSizeEstimator(index, cache); |
| 450 | } |
| 451 | |
| 452 | scrollTo(index) { |
| 453 | if (index != null) this.setScroll(this.getSpaceBefore(index)); |
no outgoing calls
no test coverage detected