React-virtualized: Cannot read property 'offset' of undefined

Created on 21 Sep 2018  路  2Comments  路  Source: bvaughn/react-virtualized

What is the current behavior?

Attached is a screencast. this has been previously reported, but closed without a fix.

Using List & Autosizer only, why does it throw and error in Grid?

What is the expected behavior?

Should not throw an error and I should be able to scroll smoothly

Which versions of React and react-virtualized, and which browser / OS are affected by this issue?

9.20.1
Chrome - latest - macOS

https://screencast.com/t/Lu7PiRwtCN

Most helpful comment

My issue solved by adding Math.ceil for calculating the number of rows

  <Grid
    columnCount={columnCount}
    columnWidth={columnWidth + spacer}
-   rowCount={list.length / columnCount}
+   rowCount={Math.ceil(list.length / columnCount)}
    ...
  />

All 2 comments

I have the same error. In my case,
I keep update the value columnCount and columnWidth when resize.
I found that the error occur when Grid change from scrollable to cannot scroll

My issue solved by adding Math.ceil for calculating the number of rows

  <Grid
    columnCount={columnCount}
    columnWidth={columnWidth + spacer}
-   rowCount={list.length / columnCount}
+   rowCount={Math.ceil(list.length / columnCount)}
    ...
  />
Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnnyji picture johnnyji  路  3Comments

athorwall picture athorwall  路  4Comments

wnz99 picture wnz99  路  3Comments

ms007 picture ms007  路  4Comments

clauderic picture clauderic  路  3Comments