MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / CellMeasurerCacheAPI

Interface CellMeasurerCacheAPI

lib/components/CellMeasurer/types.ts:194–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 * Public API of a `CellMeasurerCache` instance.
193 */
194export interface CellMeasurerCacheAPI {
195 /**
196 * Reset cached measurements for a specific cell.
197 *
198 * This should be called when a cell needs to be re-measured to handle dynamic content
199 * (e.g. replacing a loading indicator with loaded content, or reacting to state changes for stateful cells).
200 * `columnIndex` defaults to `0`.
201 */
202 clear(rowIndex: number, columnIndex?: number): void;
203
204 /**
205 * Reset cached measurements for all cells.
206 *
207 * This should be called when a `Grid`, `List` or `Table` needs to reflow its content due to a resize in a responsive layout
208 * (e.g. a change in window width may impact the height of cells).
209 */
210 clearAll(): void;
211
212 /**
213 * Returns the derived width of a column (its widest measured cell) or the default width.
214 * Pass this as the `columnWidth` prop of a `Grid` (or `MultiGrid`);
215 * it's bound to the cache, so it can be passed as-is.
216 */
217 columnWidth(params: { index: number }): number;
218
219 /**
220 * Height reported for unmeasured cells (read-only).
221 */
222 readonly defaultHeight: number;
223
224 /**
225 * Width reported for unmeasured cells (read-only).
226 */
227 readonly defaultWidth: number;
228
229 /**
230 * Returns the (measured or default) height of the specified cell.
231 * `columnIndex` defaults to `0`.
232 */
233 getHeight(rowIndex: number, columnIndex?: number): number;
234
235 /**
236 * Returns the (measured or default) width of the specified cell.
237 * `columnIndex` defaults to `0`.
238 */
239 getWidth(rowIndex: number, columnIndex?: number): number;
240
241 /**
242 * Returns true if the specified cell has already been measured.
243 * `columnIndex` defaults to `0`.
244 */
245 has(rowIndex: number, columnIndex?: number): boolean;
246
247 /**
248 * Returns true if cells have a fixed height (and a dynamic, measured width);
249 * see the `fixedHeight` option.
250 */
251 hasFixedHeight(): boolean;

Callers 18

clearMethod · 0.65
mockResizeObserverFunction · 0.65
disconnectMethod · 0.65
scrollElement.tsFile · 0.65
toggleFunction · 0.65
Masonry.test.tsxFile · 0.65
clearAllMethod · 0.65
ExampleFunction · 0.65
ExampleFunction · 0.65

Implementers 1

CellMeasurerCachelib/components/CellMeasurer/CellMeasur

Calls

no outgoing calls

Tested by

no test coverage detected