Skip to content

Instantly share code, notes, and snippets.

@zsherman
Created January 16, 2018 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsherman/ab81b6ca91d73ab69a5f714d85503b14 to your computer and use it in GitHub Desktop.
Save zsherman/ab81b6ca91d73ab69a5f714d85503b14 to your computer and use it in GitHub Desktop.
Custom CellMeasurerCache
class CustomCellMeasurerCache extends CellMeasurerCache {
constructor (props) {
super(props)
this._cellHeightEstimator = props.cellHeightEstimator
}
getHeight (rowIndex, columnIndex) {
const key = this._keyMapper(rowIndex, columnIndex)
return this._cellHeightCache.hasOwnProperty(key)
? Math.max(this._minHeight, this._cellHeightCache[key])
: this._cellHeightEstimator(rowIndex)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment