0
votes

I have a react app that uses material-ui. I recently updated @material-ui/core to 4.8.3 from 4.5.1 (I did this because I wanted to use the TableContainer component that wasn't available in the earlier version).

After the update my app no longer compiles due to errors with my DatePicker component from @material-ui/pickers. The error message I receive is:

"Type '{ renderDay: (day: MaterialUiPickersDate, selectedDate: MaterialUiPickersDate, dayInCurrentMonth: boolean) => Element; value: Moment; variant: "static"; onChange: (day: MaterialUiPickersDate) => void; ... 9 more ...; rowsMax: undefined; }' is missing the following properties from type 'Pick': color, size "

Here is a snippet of my code where I am useing the DatePicker component.

import MomentUtils from "@date-io/moment";
import { DatePicker, Day, MuiPickersUtilsProvider } from "@material-ui/pickers";
import { MaterialUiPickersDate } from "@material-ui/pickers/typings/date";

...

<MuiPickersUtilsProvider utils={MomentUtils}>
        <DatePicker
          // eslint-disable-next-line
          renderDay={renderDay}
          value={selectedDate}
          variant="static"
          onChange={handleDateChange}
          format="YYYY-MM-DD"
          disableToolbar={true}
          style={undefined}
          onFocus={undefined}
          onBlur={undefined}
          className={undefined}
          ref={undefined}
          innerRef={undefined}
          rows={undefined}
          rowsMax={undefined}
        />
</MuiPickersUtilsProvider>

Any help would be greatly appreciated!

1
Material ui updates have given lots of changes upto syntax level.. I don't know what kind of field you are using as date picker.. i have seen official site.. it uses text field which is little different from your coding... And your error shows something wrong with your onchange function.. check your states and print it in console before rendering it will be helpful for debugging - Logesh P

1 Answers

0
votes

This issue was fixed in the latest (3.2.10) version of @material-ui/pickers