Skip to content

Commit

Permalink
fix(react): create a new overlay each time component is presented, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elylucas committed Nov 5, 2019
1 parent 17fe23a commit 9fad416
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/react/src/components/createControllerComponent.tsx
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 9fad416

Please sign in to comment.