You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a project we have an image gallery build on top of Swiper. We have the zoom functionality enabled. On mobile we have a functionality in place that checks whether or not you have swiped the image in the vertical direction (gallery set to horizontal mode) and we close the gallery when this happens. However, both things - zooming + swiping (onTouchStart - onTouchEnd) - can happen at the same time. This means there are cases in which the swiper gallery is closed right after the zoom happens.
During zooming, there is a setTimeout call with callback that invokes the allowTouchMove
However, the asynchronous nature of setTimeout in our use case makes it happen after the instance is destroyed. Which leads to TypeErrors:
../../node_modules/swiper/modules/zoom.mjs in allowTouchMove at line 216:1
TypeError
Cannot set properties of undefined (setting 'preventTouchMoveFromPointerMove')
Reproduction link note: Our setup to reproduce this issue is quite complex and unreliable, but I think the issue is hopefully described/obvious enough. If not, I can try to setup a proper repro sandbox.
Expected Behavior
No errors are thrown after the Swiper instance is destroyed right after zooming.
Actual Behavior
Unreliably the error is thrown after the Swiper instance is destroyed right after zooming.
Check that this is really a bug
Reproduction link
https://codesandbox.io/p/devbox/swiper-react-zoom-pqy2gq
Bug description
On a project we have an image gallery build on top of Swiper. We have the zoom functionality enabled. On mobile we have a functionality in place that checks whether or not you have swiped the image in the vertical direction (gallery set to horizontal mode) and we close the gallery when this happens. However, both things - zooming + swiping (onTouchStart - onTouchEnd) - can happen at the same time. This means there are cases in which the swiper gallery is closed right after the zoom happens.
During zooming, there is a
setTimeout
call with callback that invokes theallowTouchMove
swiper/src/modules/zoom/zoom.mjs
Line 249 in d0b6abd
However, the asynchronous nature of
setTimeout
in our use case makes it happen after the instance is destroyed. Which leads to TypeErrors:Reproduction link note: Our setup to reproduce this issue is quite complex and unreliable, but I think the issue is hopefully described/obvious enough. If not, I can try to setup a proper repro sandbox.
Expected Behavior
No errors are thrown after the Swiper instance is destroyed right after zooming.
Actual Behavior
Unreliably the error is thrown after the Swiper instance is destroyed right after zooming.
Swiper version
11.1.4
Platform/Target and Browser Versions
Android Chrome 128
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: