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

Accordion does not work properly when defaultActiveIndex is 0 #772

Closed
bitmapdata opened this issue Oct 30, 2016 · 4 comments · Fixed by #928
Closed

Accordion does not work properly when defaultActiveIndex is 0 #772

bitmapdata opened this issue Oct 30, 2016 · 4 comments · Fixed by #928

Comments

@bitmapdata
Copy link

bitmapdata commented Oct 30, 2016

set defaultIndex to 0, the panel will not unfold. but rest of the index, it works properly.

My code here (v0.58.0)

import React, { Component } from 'react'
import { Accordion } from 'semantic-ui-react'
import faker from 'faker'
import _ from 'lodash'

const panels = _.times(3, () => ({
  title: faker.lorem.sentence(),
  content: faker.lorem.paragraphs(),
}))

export default class AccordionPanelsPropExample extends Component {
  render() {
    return (
      // at index 0 not working, but rest index working fine. 1 or 2
      <Accordion defaultActiveIndex={0} panels={panels} />
    )
  }
}
@AlvMF1
Copy link

AlvMF1 commented Oct 30, 2016

#761

@levithomason
Copy link
Member

Duplicate, see above.

@levithomason
Copy link
Member

Ah, there is a nuance here I've overlooked. The 0 default case is not working.

@oswaldosan
Copy link

i used this for reactBoostrap accordion i think you can use something similar in your defaultActiveIndex={0} parameter

<Card key={item.id}> <Card.Header> <Accordion.Toggle as={Button} variant="link" eventKey={index === 0 ? '0' : index}> {item.title} </Accordion.Toggle> </Card.Header> <Accordion.Collapse eventKey={index === 0 ? '0' : index}> <Card.Body> CARD BODY </Card.Body> </Accordion.Collapse> </Card>

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

Successfully merging a pull request may close this issue.

4 participants