From a6ea03bacc53af38ddeeaec167621d976074deb6 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Thu, 24 Oct 2024 07:08:02 -0400 Subject: [PATCH] ImageZoom: Fix when multiple images with carrousel (#2966) Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> --- src/plugins/imageZoom/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index adb0ab22..0cd63f05 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -179,6 +179,11 @@ export default definePlugin({ { match: /componentWillUnmount\(\){/, replace: "$&$self.unMountMagnifier();" + }, + + { + match: /componentDidUpdate\(\i\){/, + replace: "$&$self.updateMagnifier(this);" } ] } @@ -215,6 +220,11 @@ export default definePlugin({ } }, + updateMagnifier(instance) { + this.unMountMagnifier(); + this.renderMagnifier(instance); + }, + unMountMagnifier() { this.root?.unmount(); this.currentMagnifierElement = null;