()
| 1266 | } |
| 1267 | |
| 1268 | private reinitSwipeToClose() { |
| 1269 | // Only reinitialize if we have a presenting element and are on iOS |
| 1270 | if (getIonMode(this) !== 'ios' || !this.presentingElement) { |
| 1271 | return; |
| 1272 | } |
| 1273 | |
| 1274 | // Clean up existing gesture and animation |
| 1275 | if (this.gesture) { |
| 1276 | this.gesture.destroy(); |
| 1277 | this.gesture = undefined; |
| 1278 | } |
| 1279 | |
| 1280 | if (this.animation) { |
| 1281 | // Properly end the progress-based animation at initial state before destroying |
| 1282 | // to avoid leaving modal in intermediate swipe position |
| 1283 | this.animation.progressEnd(0, 0, 0); |
| 1284 | this.animation.destroy(); |
| 1285 | this.animation = undefined; |
| 1286 | } |
| 1287 | |
| 1288 | // Force the modal back to the correct position or it could end up |
| 1289 | // in a weird state after destroying the animation |
| 1290 | raf(() => { |
| 1291 | this.ensureCorrectModalPosition(); |
| 1292 | this.initSwipeToClose(); |
| 1293 | }); |
| 1294 | } |
| 1295 | |
| 1296 | private ensureCorrectModalPosition() { |
| 1297 | const { el, presentingElement } = this; |
no test coverage detected