react-infinite-scroller
react-infinite-scroller copied to clipboard
make option `element` of type `elementType`
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
why is this issue being ignored for so long?
if it helps anyone, I added this to my code:
delete InfiniteScroller.propTypes.element;
Someone has even made a PR for that: https://github.com/danbovey/react-infinite-scroller/pull/228
@danbovey Any chance for merging & releasing?