Skip to content

rendertostaticmarkup not working with muitheme #4143

@mikeatm

Description

@mikeatm
  • Material-UI: v0.15.0-beta.2
  • React: 1.3.6
  • Browser: Chrome 49.0.2623.87

this snipped that iv been using ReactDOM.renderToStaticMarkup now throws an error

    let container = renderToStaticMarkup(
                   <MuiThemeProvider muiTheme={getMuiTheme()}>
                    <RaisedButton   label={this.options.state.label} icon={icon} />
                   </MuiThemeProvider>
                   );

this is the error on muitheme:

warning.js:44 Warning: Failed Context Types: Required context `muiTheme` was not specified in `RaisedButton`.
RaisedButton.js:236 Uncaught TypeError: Cannot read property 'prepareStyles' of undefined

Iv recently moved form 14.X to the newest tag, and the rest of the app works after adjusting the necessary import paths as well as adding a default muitheme, how would we go about using muiTheme with the renderToStaticMarkup? is there something else here we need to add? as my code looks like its providing the
neccessary context.

i tried to change it to this and it did not work either (providing muiTheme to the button directly):

    let container = renderToStaticMarkup(
                   <MuiThemeProvider muiTheme={getMuiTheme()}>
                    <RaisedButton muiTheme={getMuiTheme()}  label={this.options.state.label} icon={icon} />
                   </MuiThemeProvider>
                   );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions