Skip to content

Commit

Permalink
refactor: add onExited onExiting to solve #2
Browse files Browse the repository at this point in the history
This is beacuse the UncontroledCollapse does not add the 
"collapsing-out" class, and it had to be added manually thorught the 
onExiting and onExited API functions of the UncontroledCollapse.
Closes #2
  • Loading branch information
einazare committed Feb 14, 2020
1 parent e222ff3 commit afe1c79
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/components/Navbars/DemoNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ class DemoNavbar extends React.Component {
// initialise
headroom.init();
}
state = {
collapseClasses: "",
collapseOpen: false
};

onExiting = () => {
this.setState({
collapseClasses: "collapsing-out"
});
};

onExited = () => {
this.setState({
collapseClasses: ""
});
};

render() {
return (
<>
Expand All @@ -64,7 +81,13 @@ class DemoNavbar extends React.Component {
<button className="navbar-toggler" id="navbar_global">
<span className="navbar-toggler-icon" />
</button>
<UncontrolledCollapse navbar toggler="#navbar_global">
<UncontrolledCollapse
toggler="#navbar_global"
navbar
className={this.state.collapseClasses}
onExiting={this.onExiting}
onExited={this.onExited}
>
<div className="navbar-collapse-header">
<Row>
<Col className="collapse-brand" xs="6">
Expand Down

0 comments on commit afe1c79

Please sign in to comment.