mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 02:31:34 +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) {
|
async present(prevProps?: Props) {
|
||||||
const { isOpen, onDidDismiss, ...cProps } = this.props;
|
const { isOpen, onDidDismiss, ...cProps } = this.props;
|
||||||
const overlay = this.overlay = await controller.create({
|
let overlay = this.overlay;
|
||||||
...cProps as any
|
if (!overlay) {
|
||||||
});
|
overlay = this.overlay = await controller.create({
|
||||||
|
...cProps as any
|
||||||
|
});
|
||||||
|
}
|
||||||
attachProps(overlay, {
|
attachProps(overlay, {
|
||||||
[dismissEventName]: onDidDismiss
|
[dismissEventName]: onDidDismiss
|
||||||
}, prevProps);
|
}, 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 {
|
render(): null {
|
||||||
|
Reference in New Issue
Block a user