Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar in Dialog Title -> Warning: You cannot call prepareStyles() on the same style object more than once. #4239

Closed
tokn136 opened this issue May 11, 2016 · 11 comments
Labels
component: dialog This is the name of the generic UI component, not the React module! component: Toolbar The React component. v0.x

Comments

@tokn136
Copy link

tokn136 commented May 11, 2016

I try to use a toolbar in the dialog title:
<Dialog title={<Toolbar></Toolbar>} />

Console output:

Warning: You cannot call prepareStyles() on the same style object more than once.

What am I doing wrong here?

  • Material-UI: v0.15.0
  • React: 15.0.2
  • Browser: Chrome 50
@tszekely
Copy link

I also get this warning on LinearProgress with something like this

<CardMedia>
...
          <LinearProgress
            key={`progress-buffer-${track.id}`}
            className={s.trackListItemProgressBar}
            mode="determinate"
            value={this.state.buffered}
            max={this.state.duration} />
...
</CardMedia>

@dptoot
Copy link

dptoot commented May 23, 2016

I am also getting the same error including a Paper element within a CardText

<CardMedia>
    <Paper zDepth={3}>
        <RemoteApiImage path={answerImage} width={width}/>
    </Paper>
</CardMedia>

@yornaath
Copy link

yornaath commented Jun 13, 2016

Also getting this for:

<Dialog
  title={
    <AppBar
      title="Legg til Rase"
      showMenuIconButton={false}
      style={{paddingTop: "10px", paddingBottom: "10px"}}
    ></AppBar>
  }
  modal={true}
  open={this.props.open}
> ... </Dialog>

@gvandyk-r7
Copy link

Also getting for <CardActions style={{ textAlign: 'center', padding: '0px' }}> ... </CardActions>

@a17
Copy link

a17 commented Jul 25, 2016

Also getting this for <Dialog title={<Tabs ... />} />.

@mpontikes mpontikes mentioned this issue Aug 5, 2016
13 tasks
@nearapogee
Copy link

Also getting this when nesting Cards. Seems to be related to getStyles in Paper, but stopped looking.

<Card>
  <Card>
  </Card>
</Card>
  • Material UI 0.16.4

@yanickrochon
Copy link

yanickrochon commented Dec 19, 2016

What's the resolve to this issue?

Edit: in most case, a workaround is to wrap the component inside a div. For example :

<Dialog title={ <div><Tabs ... /></div> } ... >

@PolGuixe
Copy link
Contributor

PolGuixe commented Dec 22, 2016

@ochicf and I we have come with a hack that omits this warning: https://github.com/callemall/material-ui/blob/master/src/utils/callOnce.js

Use Case
We wanted to use <Paper/> as the containerElement for a <GridTile/>, it worked but we were getting the annoying warning.

Hack
And I say hack and not solution, because this feels like a total hack:

import React from 'react';
import {Paper} from 'material-ui';
import _ from 'lodash';

class PaperForGridTile extends React.Component {
  render() {
    return (
        <Paper
          {...this.props}
          style={_.omit(this.props.style, [ 'muiPrepared' ])}
        />
    );
  }
}

export default PaperForGridTile;

What is the worst that can happen?

@astanecki
Copy link

@yanickrochon true, in nested FlatButton in MediaCard also works 👍

@ghost
Copy link

ghost commented Feb 28, 2017

@yanickrochon Thanks That works for me

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 28, 2017

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. We changed the styling solution, it's no longer an issue.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: dialog This is the name of the generic UI component, not the React module! component: Toolbar The React component. v0.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! component: Toolbar The React component. v0.x
Projects
None yet
Development

No branches or pull requests