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

You cannot call prepareStyles() on the same style object more than once #4177

Closed
zabojad opened this issue May 6, 2016 · 3 comments
Closed
Labels
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. v0.x

Comments

@zabojad
Copy link

zabojad commented May 6, 2016

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
@nathanmarks
Copy link
Member

nathanmarks commented May 7, 2016

outdated version, this is fixed

@davidnguyen11
Copy link

davidnguyen11 commented Apr 13, 2017

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>

@oliverlloyd
Copy link

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.

@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 v0.x package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. 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
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. v0.x
Projects
None yet
Development

No branches or pull requests

6 participants