Skip to content

Commit

Permalink
ImageZoom: Fix when multiple images with carrousel (#2966)
Browse files Browse the repository at this point in the history
Co-authored-by: Nuckyz <[email protected]>
  • Loading branch information
sadan4 and Nuckyz authored Oct 24, 2024
1 parent e620431 commit a6ea03b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/imageZoom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ export default definePlugin({
{
match: /componentWillUnmount\(\){/,
replace: "$&$self.unMountMagnifier();"
},

{
match: /componentDidUpdate\(\i\){/,
replace: "$&$self.updateMagnifier(this);"
}
]
}
Expand Down Expand Up @@ -215,6 +220,11 @@ export default definePlugin({
}
},

updateMagnifier(instance) {
this.unMountMagnifier();
this.renderMagnifier(instance);
},

unMountMagnifier() {
this.root?.unmount();
this.currentMagnifierElement = null;
Expand Down

0 comments on commit a6ea03b

Please sign in to comment.