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

AccordionItem closes after button click #117

Closed
horak opened this issue Apr 29, 2017 · 3 comments
Closed

AccordionItem closes after button click #117

horak opened this issue Apr 29, 2017 · 3 comments

Comments

@horak
Copy link

horak commented Apr 29, 2017

I have something like this.

  handleDeleteUser = (e) => {
    if (this.state.confirm) {
      this.setState({
        confirm: false 
      })
    } else {
      this.setState({
        confirm: true 
      })
    }
  }

...

<button type='button' id={id} onClick={this.handleDeleteUser}>
  {this.state.confirm ? 'Really?' : 'Delete'}
</button>

Setting state within the handler closes all open accordions. Any ideas why?

@psimyn
Copy link
Contributor

psimyn commented May 4, 2017

Is the button within an AccordionTitle or inside of an item? do you have a more complete example?

I think this is the same issue as #116 - please reopen if it is different

@horak
Copy link
Author

horak commented May 5, 2017

Yup, that's the one, sorry about that.

@project707
Copy link

This kind of seems different to me in that this is closing accordions and in #116 it seems like the accordion functionality breaks, but maybe I'm misreading that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants