tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Button ripple effect bug!? #489

Open edelgarat opened 7 years ago

edelgarat commented 7 years ago

After changing the value of the button, the ripple effect stops working:

import * as MDL from "react-mdl";
const { Button } = MDL;
class App extends React.Component {
    constructor() {
        super();
        this.state = { a: true };
        this.onBtnClick = this.onBtnClick.bind(this);
    }
    onBtnClick() {
        //this.setState({ a: !this.state.a });
        setTimeout(() => this.setState({ a: !this.state.a }), 100);//delay for drawing ripple effect
    }
    render() {
        return <div>
            <Button ripple style={{backgroundColor:"lightgreen"}} onClick={this.onBtnClick}>{this.state.a ? "1" : "2"}</Button>
        </div>;
    }
}