React-bootstrap accordion not working properly

情到浓时终转凉″ 提交于 2019-12-06 06:34:25

So I hope that you've already found the answer to your question, but the following code should work. I think you simply need to change key={} to eventKey={} Let me know if this doesn't work for you.

var React = require('react');
var ReactPropTypes = React.PropTypes;
var Accordion = require('react-bootstrap').Accordion;
var Panel = require('react-bootstrap').Panel;    

var LeftSideInfo = React.createClass({
render: function () {
    var open = 3;
    return (
      <Accordion>
        <Panel header="Recommended Assignments" eventKey='1'>
          Some Info here
        </Panel>
        <Panel header="Candidate Information" eventKey='2'>
          More Info here
        </Panel>
        <Panel header="Contact Information" eventKey={open}>
          Yet another Panel
        </Panel>
       </Accordion>
    );
  }
});

module.exports = LeftSideInfo;

As a side note, I'm trying to figure out how to stop it from closing one panel when another one is clicked open. I think I just need to play with the eventKey

Use Panels separately to keep multiple panels open. Accordion will collapse the inactive panels automatically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!