mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 09:34:19 +08:00
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user