captDaylight
captDaylight

Reputation: 2234

react-virtualized CellMeasurer returns undefined getRowHeight

I'm using the react-virtualized wizard to generate a starting point for what I'm using. Essentially I have only clicked "Will your collection have more than 1 row of data?", which gives you this:

<AutoSizer>
  {({ height, width }) => (
    <CellMeasurer
      cellRenderer={yourCellRenderer}
      columnCount={numColumns}
      rowCount={numRows}
      width={width}
    >
      {({ getRowHeight }) => (
        <List
          height={height}
          rowHeight={getRowHeight}
          rowRenderer={({ index, isScrolling }) => collection.getIn([index, "name"])}
          width={width}
        />
      )}
    </CellMeasurer>
  )}
</AutoSizer>

However after replacing cellRenderer and rowRenderer with my own methods, the getRowHeight variable comes back as undefined. It's a bit murky to me what's going on, but List is throwing an error off the bat because it's not getting anything passed to the rowHeight prop.

Upvotes: 0

Views: 464

Answers (1)

bvaughn
bvaughn

Reputation: 13487

The Wizard page is outdated. It is currently outputting syntax for version 8 and I recently released version 9. Sorry about that. I'll try to get it updated soon.

In the meanwhile you can read about the new CellMeasurer here, specifically learn about how it changed here, and see some example uses here.

Upvotes: 1

Related Questions