question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VM84:36 Warning: Failed context type: The context `muiTheme` is marked as required in `DatePicker`, but its value is `undefined`.

See original GitHub issue

First I got this warning -

Warning: Failed context type: The context muiTheme is marked as required in DatePicker, but its value is undefined.

Then - When clicked on ‘DatePicker’ component nothing happens. DatePicker popup does not open up.

Steps to reproduce

  1. Require the DatePicker import React from ‘react’; import DatePicker from ‘material-ui/DatePicker’;
  2. Use it in your component.

Versions

  • Material-UI:

“material-ui”: “^0.19.1”,

  • React: “react”: “^0.14.3”, “react-dom”: “^0.14.3”,
  • Browser: Chrome, Mozilla Note: I am not using any react-tap-event plugin. Previously I used “react-tap-event-plugin”: “^0.2.2”, but issue was still there so I removed it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Anushree-Desaicommented, Jan 31, 2018

I am using DateTimePicker as below:

import DateTimePicker from 'material-ui-datetimepicker';
import DatePickerDialog from 'material-ui/DatePicker/DatePickerDialog';
import TimePickerDialog from 'material-ui/TimePicker/TimePickerDialog';

<DateTimePicker
     onChange={this.setDate}
     DatePicker={DatePickerDialog}
     TimePicker={TimePickerDialog}
/>

It is throwing below error: warning.js:36 Warning: Failed context type: The context muiTheme is marked as required in TextField, but its value is undefined.

And

Cannot read property ‘prepareStyles’ of undefined

2reactions
techyrajeevcommented, Sep 4, 2017

Thanks @oliviertassinari. BTW I fixed it via wrapping inside MuiThemeProvider.

import React, { Component } from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';

require('../../sass/app.scss');

const App = ({children}) => (
  <MuiThemeProvider>
          <div className="main">
                {/*{ isGrayNav ? <GrayNavBar/> : <MainNavBar/> } */}
                {children}
                <Footer/>
           </div>
  </MuiThemeProvider>
);

export default App;
Read more comments on GitHub >

github_iconTop Results From Across the Web

The context `muiTheme` is marked as required in `DatePicker ...
First I got this warning - Warning: Failed context type: The context muiTheme is marked as required in DatePicker, but its value is...
Read more >
reactjs - I cannot use material-ui components after update to ...
I got this message in my console: Failed Context Types: Required context muiTheme was not specified ...
Read more >
Migration from @material-ui/pickers - MUI
We introduced a new required renderInput prop. This simplifies using non-MUI text field input components. <DatePicker renderInput= ...
Read more >
Material-UI Addon | Storybook: Frontend workshop for UI ...
This is addon for React Storybook which wraps your components into MuiThemeProvider. This accelerates and simplifies the development process for Material-UI ...
Read more >
Top React date pickers for 2021 - LogRocket Blog
There are a lot of date picker libraries you can choose from, learn about some of the date picker libraries that I found...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found