Skip to content

Commit

Permalink
Fixed positioning issue in Popover
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Bartlett committed Apr 26, 2019
1 parent fbe4b09 commit 2785c90
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Popover/Popover.js
Expand Up @@ -140,6 +140,14 @@ class Popover extends Component {

componentDidMount() {
this.placementTimeout = setTimeout(this.setPlacement);

if (this.props.open) {
setTimeout(() => {
this.setState({
setPlacement: true,
})
});
}
}

componentWillReceiveProps(nextProps) {
Expand All @@ -154,6 +162,13 @@ class Popover extends Component {
this.setState({
open: true,
closing: false,
setPlacement: false,
}, () => {
setTimeout(() => {
this.setState({
setPlacement: true,
})
})
});
} else {
if (nextProps.animated) {
Expand Down Expand Up @@ -213,7 +228,10 @@ class Popover extends Component {
...other
} = this.props;

let styleRoot = style;
let styleRoot = {
...style,
opacity: this.state.setPlacement ? 1 : 0,
};

if (!animated) {
styleRoot = {
Expand Down

0 comments on commit 2785c90

Please sign in to comment.