Skip to content

Commit

Permalink
fix(Visibility): fire on window resize, fix behaviour of reverse calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Fedyashov committed Sep 19, 2017
1 parent 65ce852 commit 2013cb2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/behaviors/Visibility/Visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export default class Visibility extends Component {

const { context, fireOnMount } = this.props

context.addEventListener('resize', this.handleScroll)
context.addEventListener('scroll', this.handleScroll)
if (fireOnMount) this.handleUpdate()
}
Expand All @@ -201,6 +202,7 @@ export default class Visibility extends Component {
if (!isBrowser) return

const { context } = this.props
context.removeEventListener('resize', this.handleScroll)
context.removeEventListener('scroll', this.handleScroll)
}

Expand Down

0 comments on commit 2013cb2

Please sign in to comment.