Skip to content

When onChange function passed to Checkbox it stops working #228

@MileanCo

Description

@MileanCo

Describe the bug
When you pass the onChange function the checkbox stops changing state and stays either checked or unchecked.

If you remove onChange(), then it works but I cannot do anything based on if it was clicked or not. I think this.setState() is what is messing it up.

        <Checkbox
            label="Apples"
            flexDirection="row"
            initialValue={true}
            onChange={(val) => {
              if (val) {
                  this.setState({apples: false});
                } else {
                  this.setState({apples: true});
                }
            }}
          />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions