Skip to content

Commit 3272d8b

Browse files
committed
Rename "navOpen" to "navExpanded"
There seems to be a non-working mix navOpen and navExpanded which means getInitialState() sets navExpanded in the state, but isNavOpen refers to the uninitialised navOpen. I have made it all use navExpanded, which appears to be the intention, and also added some sensible defaults to make it easier to get right.
1 parent b26f1c1 commit 3272d8b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Navbar.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ var Navbar = React.createClass({
5656
}
5757

5858
this.setState({
59-
navOpen: !this.state.navOpen
59+
navExpanded: !this.state.navExpanded
6060
});
6161
},
6262

63-
isNavOpen: function () {
64-
return this.props.navOpen != null ? this.props.navOpen : this.state.navOpen;
63+
isNavExpanded: function () {
64+
return this.props.navExpanded != null ? this.props.navExpanded : this.state.navExpanded;
6565
},
6666

6767
render: function () {
@@ -87,7 +87,7 @@ var Navbar = React.createClass({
8787
return cloneWithProps(child, {
8888
navbar: true,
8989
collapsable: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.key,
90-
expanded: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.key && this.isNavOpen(),
90+
expanded: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.key && this.isNavExpanded(),
9191
key: child.props.key,
9292
ref: child.props.ref
9393
});

0 commit comments

Comments
 (0)