Skip to content

Commit

Permalink
Merge pull request #143 from alimek/master
Browse files Browse the repository at this point in the history
Fix problem when modal is destroyed but it still try close it
  • Loading branch information
mmazzarolo committed Apr 18, 2018
2 parents 832c2ed + 8a85972 commit 175caa8
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions src/index.js
Expand Up @@ -291,14 +291,16 @@ export class ReactNativeModal extends Component {
this.state.pan.setValue({ x: 0, y: 0 });
}

this.contentRef[this.animationIn](this.props.animationInTiming).then(() => {
this.transitionLock = false;
if (!this.props.isVisible) {
this._close();
} else {
this.props.onModalShow();
}
});
if (this.contentRef) {
this.contentRef[this.animationIn](this.props.animationInTiming).then(() => {
this.transitionLock = false;
if (!this.props.isVisible) {
this._close();
} else {
this.props.onModalShow();
}
});
}
};

_close = () => {
Expand Down Expand Up @@ -326,24 +328,26 @@ export class ReactNativeModal extends Component {
}
}

this.contentRef[animationOut](this.props.animationOutTiming).then(() => {
this.transitionLock = false;
if (this.props.isVisible) {
this.open();
} else {
this.setState(
{
showContent: false
},
() => {
this.setState({
isVisible: false
});
}
);
this.props.onModalHide();
}
});
if (this.contentRef) {
this.contentRef[animationOut](this.props.animationOutTiming).then(() => {
this.transitionLock = false;
if (this.props.isVisible) {
this.open();
} else {
this.setState(
{
showContent: false
},
() => {
this.setState({
isVisible: false
});
}
);
this.props.onModalHide();
}
});
}
};

render() {
Expand Down

0 comments on commit 175caa8

Please sign in to comment.