mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
fix(react): re attach props on update, fixes 20192 (#20228)
This commit is contained in:
@ -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);
|
||||
}
|
||||
@ -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() {
|
||||
|
Reference in New Issue
Block a user