Fixing issue when isVisible is made false while the popover is animating in

This commit is contained in:
SteffeyDev
2019-03-17 13:41:11 -04:00
parent f040b8f985
commit d90cce575c
2 changed files with 18 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-popover-view",
"version": "1.0.17",
"version": "1.0.18",
"description": "A <Popover /> component for react-native",
"main": "src/index.js",
"author": "Peter Steffey <steffeydev@icloud.com> (https://github.com/steffeydev)",

View File

@@ -630,11 +630,17 @@ class Popover extends React.Component {
}
this.debug("componentWillReceiveProps - Awaiting popover show");
} else {
if (this.state.showing)
this.animateOut();
else
if (this.state.visible) {
if (this.state.showing)
this.animateOut();
else
this.animateOutAfterShow = true;
this.debug("componentWillReceiveProps - Hiding popover");
}
else {
this.props.doneClosingCallback();
this.debug("componentWillReceiveProps - Hiding popover");
this.debug("componentWillReceiveProps - Popover never shown");
}
}
} else if (willBeVisible) {
this.calculateRect(nextProps, fromRect => {
@@ -732,7 +738,13 @@ class Popover extends React.Component {
scale: 1,
translatePoint,
easing: Easing.out(Easing.back()),
callback: () => this.setState({showing: true})
callback: () => {
this.setState({showing: true});
if (this.animateOutAfterShow) {
this.animateOut();
this.animateOutAfterShow = false;
}
}
})
}