jkslyby / material-ui-datetime-range-picker

A datetime range picker built off of material-ui
MIT License
18 stars 11 forks source link

TypeError: Cannot read property 'prepareStyles' of undefined #5

Closed rehman-00001 closed 5 years ago

rehman-00001 commented 5 years ago

Just installed the package and followed the instructions mentioned in the README. But when launched, it throws the following error:

TypeError: Cannot read property 'prepareStyles' of undefined DateRangePicker.render node_modules/material-ui-datetime-range-picker/DatePicker/DateRangePicker.js:483 480 | utils = _props.utils, 481 | other = _objectWithoutProperties(_props, ['DateTimeFormat', 'autoOk', 'autoOpenField', 'blockedDateTimeRanges', 'calendarDateWidth', 'calendarTimeWidth', 'cancelLabel', 'className', 'container', 'dayButtonSize', 'dialogContainerStyle', 'end', 'endLabel', 'endLabelDate', 'endLabelTime', 'firstDayOfWeek', 'formatDisplay', 'layout', 'locale', 'mode', 'okLabel', 'onDismiss', 'onFocus', 'onShow', 'onClick', 'showCalendarDate', 'showCalendarStatus', 'start', 'startLabel', 'startLabelDate', 'startLabelTime', 'style', 'textFieldStyle', 'utils']); 482 |

483 | var prepareStyles = this.context.muiTheme.prepareStyles; | ^ 484 | var styles = this.getStyles(); 485 | var _state = this.state, 486 | selectedStartDate = _state.selectedStartDate,

Howardjy1138 commented 5 years ago

this is because MuiThemeProvider didn't added it in your react component, but technically, the component itself should handle without provide the theme.

cedricve commented 5 years ago

same error..

piwnk commented 5 years ago

same here

rehman-00001 commented 5 years ago

Created a pull-request with a fix for this. :+1:

jkslyby commented 5 years ago

Thanks @rehman-00001! Your PR has been merge.

MarcoPortillo commented 4 years ago

@rehman-00001 @jkslyby I am still having same error