Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EventKeys in NavDropdown in React-Bootstrap

I have a problem with the eventKey thing in NavDropdowns.

var Navigation = React.createClass({

  handleSelect: function(eventKey){
    console.log(eventKey);
  },

  render: function() {
    return (
      <Navbar brand='Navbar' toggleNavKey={0}>
        <CollapsibleNav eventKey={0} onSelect={this.handleSelect}>

          <Nav navbar>
            <NavItem eventKey={1}>Home</NavItem>
          </Nav> 


          <Nav navbar right hide>
            <NavItem eventKey={2}>Login</NavItem>

            <NavDropdown eventKey={3} title='NavDropdown' id='basic-nav-dropdown'>
              <MenuItem eventKey={4}>Action 1</MenuItem>
              <MenuItem eventKey={5}>Action 2</MenuItem>
            </NavDropdown>
          </Nav>

        </CollapsibleNav>
      </Navbar>

    )
  }
});

I want to be able in my selectHandler to tell what Nav element was clicked. This works great for all elements except the NavDropdown:

Clicking the Dropdown does not trigger the selectHandler, which is fine. But when I click one of the MenuItem, instead of giving me the eventKey, it gives me an event object.

How can I modify the NavDropdown so that it gives me the eventKey?


Edit: My versions are:

"react": "^0.14.0-beta3",
"react-bootstrap": "^0.25.100-react-pre.0",
like image 811
MoeSattler Avatar asked Nov 22 '22 06:11

MoeSattler


1 Answers

It is a bug in react-bootstrap

https://github.com/react-bootstrap/react-bootstrap/issues/1268

like image 93
MoeSattler Avatar answered Dec 11 '22 02:12

MoeSattler