Skip to content

Commit

Permalink
fix(Popup): apply RAF to pin Popup to trigger component
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaringe committed May 8, 2018
1 parent 9bc4905 commit a8c3d70
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/Popup/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export default class Popup extends Component {
const { hideOnScroll } = this.props

if (hideOnScroll) eventStack.sub('scroll', this.hideOnScroll, { target: window })
this.setPosition()
_.invoke(this.props, 'onMount', e, this.props)
}

Expand All @@ -332,6 +333,14 @@ export default class Popup extends Component {
}
}

setPosition = () => {
if (this.triggerRef) {
this.setPopupStyle(this.props.position)
}

this.animationRequestId = requestAnimationFrame(this.setPosition)
}

render() {
const {
basic,
Expand Down

0 comments on commit a8c3d70

Please sign in to comment.