react-infinite-scroller icon indicating copy to clipboard operation
react-infinite-scroller copied to clipboard

make option `element` of type `elementType`

Open robsdedude opened this issue 4 years ago • 2 comments

I'm using material-ui and I want the scroll container to be a Grid node. So I did

import { Grid } from "@material-ui/core";
...
<InfiniteScroll
  loadMore={loadMore}
  hasMore={hasNextPage}
  loader={<p>Loading...</p>}
  element={Grid} container spacing={3}
>
...

which works great. Note that container and spacing are props that are passed down to the Grid component.

The only problem is that I get a warning in the dev console:

Warning: Failed prop type: Invalid prop `element` supplied to `InfiniteScroll`, expected a ReactNode.

This could easily be fixed by changing

InfiniteScroll.propTypes = {
  ...
  element: _propTypes2.default.node,
  ...
};

to

element: _propTypes2.default.elementType

robsdedude avatar Sep 08 '19 20:09 robsdedude