Skip to content

Commit

Permalink
fix(react): re attach props on update, fixes 20192 (#20228)
Browse files Browse the repository at this point in the history
  • Loading branch information
elylucas committed Jan 17, 2020
1 parent aff9612 commit 9e35ebe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/react/src/components/createOverlayComponent.tsx
Expand Up @@ -59,6 +59,10 @@ export const createOverlayComponent = <OverlayComponent extends object, OverlayT
}

async componentDidUpdate(prevProps: Props) {
if (this.overlay) {
attachProps(this.overlay, this.props, prevProps);
}

if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
this.present(prevProps);
}
Expand All @@ -75,19 +79,19 @@ export const createOverlayComponent = <OverlayComponent extends object, OverlayT
[dismissEventName]: this.handleDismiss
};

const overlay = this.overlay = await controller.create({
this.overlay = await controller.create({
...elementProps,
component: this.el,
componentProps: {}
});

if (this.props.forwardedRef) {
(this.props.forwardedRef as any).current = overlay;
(this.props.forwardedRef as any).current = this.overlay;
}

attachProps(overlay, elementProps, prevProps);
attachProps(this.overlay, elementProps, prevProps);

await overlay.present();
await this.overlay.present();
}

render() {
Expand Down

0 comments on commit 9e35ebe

Please sign in to comment.