Material-ui: You cannot call prepareStyles() on the same style object more than once

Created on 6 May 2016  ·  3Comments  ·  Source: mui-org/material-ui

I'm getting "2 Warning: You cannot call prepareStyles() on the same style object more than once." on an Avatar component with the below code:

<Card className="blabla"
       style={mystyle}>
    <CardMedia>
        <Avatar src={myPictureUrl}/>
    </CardMedia>
    <!-- ... -->
</Card>

Versions:

  • material-ui: 0.14.4
  • react: 0.14.8
  • chrome: 50.0.2661.75

Most helpful comment

I still have this issue:

  • material-ui: 0.17.1
  • react: 15.4.2
  • chrome: 57.0.2987.133 (64 bit)

Temporary solved

<Card className="blabla" style={mystyle}>
    <CardMedia>
        <div>
             <Avatar src={myPictureUrl}/>
        </div>
    </CardMedia>
    <!-- ... -->
</Card>

All 3 comments

outdated version, this is fixed

I still have this issue:

  • material-ui: 0.17.1
  • react: 15.4.2
  • chrome: 57.0.2987.133 (64 bit)

Temporary solved

<Card className="blabla" style={mystyle}>
    <CardMedia>
        <div>
             <Avatar src={myPictureUrl}/>
        </div>
    </CardMedia>
    <!-- ... -->
</Card>

Still a problem in 0.18.1. Including the svg icon to the code below causes this error.

        <CardMedia
          overlay={
            <CardTitle
              title={this.props.device.label}
              subtitle={`Created ${moment(this.props.device.created).fromNow()}`}
            />
          }
          overlayContentStyle={{background: background}}
        >
          <img src={this.chooseImage(this.props.device.label)} alt="" />
        <CheckIcon />
        </CardMedia>

nndung179's workaround of wrapping the element in a div works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anthony-dandrea picture anthony-dandrea  ·  3Comments

mb-copart picture mb-copart  ·  3Comments

ericraffin picture ericraffin  ·  3Comments

revskill10 picture revskill10  ·  3Comments

ghost picture ghost  ·  3Comments