HAVE YOU ALREADY SEARCHED FOR SIMILAR ISSUES? PLEASE HELP US OUT AND DOUBLE-CHECK FIRST!
ALSO, PLEASE DON'T BE THAT PERSON WHO DELETES THIS TEMPLATE. IT'S HERE FOR A REASON.
THANKS!
WHICH VERSION OF REACT ARE YOU USING?
Officially Supported:
[ ] v0.14.x
Community Supported:
[x] v15.0.x (15.4.2)
WHICH BROWSER ARE YOU USING?
Officially Supported:
[ ] IE 9 / IE 10 / IE 11
[ ] Edge
[x] Chrome
Should work:
[ ] Firefox
[ ] Safari
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/adazzle/react-data-grid/blob/master/CONTRIBUTING.md
Current behavior
In v1.0.81, ReactDataGrid component causes the following warning: Warning: Invalid argument supplied to oneOf, expected an instance of array.
Looking at the source for HeaderRow you can see the property sortDirection uses React.PropTypes.oneOf() which takes an array, but is not receiving an array.
propTypes: {
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: PropTypes.number.isRequired,
columns: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
onColumnResize: PropTypes.func,
onSort: PropTypes.func.isRequired,
onColumnResizeEnd: PropTypes.func,
style: PropTypes.shape(HeaderRowStyle),
sortColumn: PropTypes.string,
sortDirection: React.PropTypes.oneOf(SortableHeaderCell.DEFINE_SORT),
cellRenderer: PropTypes.func,
headerCellRenderer: PropTypes.func,
filterable: PropTypes.bool,
onFilterChange: PropTypes.func,
resizing: PropTypes.object,
onScroll: PropTypes.func,
rowType: PropTypes.string,
draggableHeaderCell: PropTypes.func
},
Expected/desired behavior
Component should not cause warnings when properly used.
Reproduction of the problem
Simply use an instance of the ReactDataGrid component
What is the expected behavior?
See above
What is the motivation / use case for changing the behavior?
Warnings cause by vendor libraries are annoying :)
Thanks @wescravens, we will accept a PR to fix that
As the DEFINE_SORT is an object but oneOf is expecting an enum
const DEFINE_SORT = {
ASC: 'ASC',
DESC: 'DESC',
NONE: 'NONE'
};
sortDirection: React.PropTypes.oneOf(SortableHeaderCell.DEFINE_SORT),
Possible fix could be
sortDirection: React.PropTypes.oneOf(Object.values(SortableHeaderCell.DEFINE_SORT)),
.
Thanks,
Rajesh
Hi, why was this issue closed? I'm getting a similar warning / error "Warning: Invalid argument supplid to oneOfType. Expected an array of check functions, but received undefined at index 0."
Is there any solution to fix this?
same
is this warning issue fixed ??
Still getting this error too.
Most helpful comment
Hi, why was this issue closed? I'm getting a similar warning / error "Warning: Invalid argument supplid to oneOfType. Expected an array of check functions, but received undefined at index 0."
Is there any solution to fix this?