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

React Collapse in A list causes all collapsed items to open when one is clicked #58

Closed
AdamKyle opened this issue Jun 29, 2016 · 2 comments

Comments

@AdamKyle
Copy link

AdamKyle commented Jun 29, 2016

This might not be a bug so much as user error, but if you render multiple:

import Collapse        from 'react-collapse';

...

<Collapse isOpened={this.props.hidden}>
  ... 
</Collapse>

in a list, and then click on one item in the list to trigger it to open, ALL of them will open. Not sure the best approach to get around this. Is there some option or some way where I can say if X is clicked then only open X and not Y and Z

@nkbt
Copy link
Owner

nkbt commented Jun 30, 2016

This seem like concern of your app. You define which Collapse is going to be opened or closed =). Collapse gets only one prop isOpened. You can have an array of those in your own component and do something like:

<div>
  <Collapse isOpened={!this.props.hidden[0]}>
  ... 
  </Collapse>
  <Collapse isOpened={!this.props.hidden[1]}>
  ... 
  </Collapse>
  ... and so on
</div>

@nkbt
Copy link
Owner

nkbt commented Aug 8, 2016

Closing this for now, feel free to reopen if you still have issues with this

@nkbt nkbt closed this as completed Aug 8, 2016
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

2 participants