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 #7

Closed alvamanu closed 4 years ago

alvamanu commented 4 years ago

`DateRangePicker.render node_modules/babel-loader/lib/index.js??ref--6-oneOf-2!/Users/manuel/Development/Docker/vhosts/dois-react/node_modules/material-ui-datetime-range-picker/DatePicker/DateRangePicker.js:484 481 | utils = _props.utils, 482 | 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']); 483 |

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

consciousnessdev commented 4 years ago

still there is no progress?

jkslyby commented 4 years ago

What version of material-ui are you using? Currently this only supports versions before v1+. I would like to rewrite it for the current version of material-ui but I haven't had time. If you want to use it with the older version, you have to include the MuiThemeProvider. Please see the docs for the older 0.2 version of Material-UI

import getMuiTheme from 'material-ui/styles/getMuiTheme';
import theme from './theme';

<MuiThemeProvider muiTheme={getMuiTheme(theme)}>
    <DateRangePicker ....
</MuiThemeProvider>