fix(react): create a new overlay each time component is presented, fixes #19841, #19823 (#19842)

This commit is contained in:
Ely Lucas
2019-11-05 16:49:10 -07:00
committed by Ely Lucas
parent e5e9dd5dfe
commit 2f5d823748

View File

@ -54,18 +54,15 @@ export const createControllerComponent = <OptionsType extends object, OverlayTyp
async present(prevProps?: Props) {
const { isOpen, onDidDismiss, ...cProps } = this.props;
let overlay = this.overlay;
if (!overlay) {
overlay = this.overlay = await controller.create({
...cProps as any
});
}
attachProps(overlay, {
this.overlay = await controller.create({
...cProps as any
});
attachProps(this.overlay, {
[dismissEventName]: onDidDismiss
}, prevProps);
// Check isOpen again since the value could of changed during the async call to controller.create
if (this.props.isOpen === true) {
await overlay.present();
await this.overlay.present();
}
}