From 42be1f2cc3f1a388a2a00860a05d8d67d0719250 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Thu, 7 Mar 2024 15:09:55 +0300 Subject: [PATCH] Work for https://github.com/surveyjs/survey-creator/issues/5282 - If question width is small for text type then changing input type breaks adaptivity - update responsivity manager on model changed --- src/actions/action.ts | 1 + src/react/components/action-bar/action-bar.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/actions/action.ts b/src/actions/action.ts index a32a41ab19..43e904ec08 100644 --- a/src/actions/action.ts +++ b/src/actions/action.ts @@ -458,6 +458,7 @@ export class Action extends BaseAction implements IAction, ILocalizableOwner { return this._component; } public dispose(): void { + this.updateCallback = undefined; this.action = undefined; super.dispose(); if (this.popupModel) { diff --git a/src/react/components/action-bar/action-bar.tsx b/src/react/components/action-bar/action-bar.tsx index ffa8ea4988..635b2e8009 100644 --- a/src/react/components/action-bar/action-bar.tsx +++ b/src/react/components/action-bar/action-bar.tsx @@ -46,6 +46,19 @@ export class SurveyActionBar extends SurveyElementBase { this.model.resetResponsivityManager(); } } + componentDidUpdate(prevProps: IActionBarProps, prevState: any): void { + super.componentDidUpdate(prevProps, prevState); + if(prevProps.model == this.props.model) { + return; + } + if (!!this.model.hasActions) { + this.model.resetResponsivityManager(); + const container: HTMLDivElement | null = this.rootRef.current; + if(!!container) { + this.model.initResponsivityManager(container, (callback) => { setTimeout(callback); }); + } + } + } protected getStateElement(): Base { return this.model;