Skip to content

RaisedButton sets incorrect style when dynamically updating disabled state #837

@joewalker

Description

@joewalker

I have a form which disables the 'save' button when any of the fields are invalid, however the color of the save button is out of sync with its state. It correctly can't be pressed when disabled, and the zIndex is right too, however the color is wrong.

I did some digging and it looks like the problem might be that RaisedButton.componentWillReceiveProps calls getStyles(), but getStyles reads from this.props which clearly isn't up to date at this point.
Perhaps the call to this.styles = this.getStyles(); should be delayed until render() or something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: buttonChanges related to the button.scope: stylesSpecific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions