mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
fix(react): checking isOpen again after async call before opening overlay, fixes #19755
This commit is contained in:
@ -54,13 +54,19 @@ export const createControllerComponent = <OptionsType extends object, OverlayTyp
|
||||
|
||||
async present(prevProps?: Props) {
|
||||
const { isOpen, onDidDismiss, ...cProps } = this.props;
|
||||
const overlay = this.overlay = await controller.create({
|
||||
...cProps as any
|
||||
});
|
||||
let overlay = this.overlay;
|
||||
if (!overlay) {
|
||||
overlay = this.overlay = await controller.create({
|
||||
...cProps as any
|
||||
});
|
||||
}
|
||||
attachProps(overlay, {
|
||||
[dismissEventName]: onDidDismiss
|
||||
}, prevProps);
|
||||
await overlay.present();
|
||||
// Check isOpen again since the value could of changed during the async call to controller.create
|
||||
if (this.props.isOpen === true) {
|
||||
await overlay.present();
|
||||
}
|
||||
}
|
||||
|
||||
render(): null {
|
||||
|
Reference in New Issue
Block a user