Skip to content

Commit

Permalink
- Cannot force call setState
Browse files Browse the repository at this point in the history
  • Loading branch information
Manu committed Nov 29, 2018
1 parent aaed86e commit 5723025
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/Navbars/AdminNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class AdminNavbar extends React.Component {
componentDidMount() {
window.addEventListener("resize", this.updateColor);
}
componentWillUnmount() {
window.removeEventListener("resize", this.updateColor);
}
// function that adds color white/transparent to the navbar on resize (this is for the collapse)
updateColor = () => {
if (window.innerWidth < 993 && this.state.collapseOpen) {
Expand Down
3 changes: 3 additions & 0 deletions src/components/Navbars/RTLNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class AdminNavbar extends React.Component {
componentDidMount() {
window.addEventListener("resize", this.updateColor);
}
componentWillUnmount() {
window.removeEventListener("resize", this.updateColor);
}
// function that adds color white/transparent to the navbar on resize (this is for the collapse)
updateColor = () => {
if (window.innerWidth < 993 && this.state.collapseOpen) {
Expand Down

0 comments on commit 5723025

Please sign in to comment.