ionic-framework: bug: ion-slides regression in modals (unusable after 4.11.0)
Bug Report
Ionic version:
4.11.0
Current behavior: ion-slides now behaves strangely when placed in modals after v4.11.0, touch events aren’t correctly handled and scrolling is not working, as well as layout is stretched with incorrect dimensions calculation.
v4.10.3 is working correctly.
Expected behavior: It should work as before
Steps to reproduce: Put an ion-slides with 2 or 3 photos in a modal page and present it, try to drag left or right, you will get stuck between photos.
Other information:
Ionic info:
Ionic:
Ionic CLI : 5.4.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 12 other plugins)
Utility:
cordova-res : 0.6.0 (update available: 0.8.0)
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (/Users/omardoma/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v10.16.3 (/usr/local/Cellar/node@10/10.16.3/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 11.1 Build version 11A1027
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 39 (9 by maintainers)
Would love to hear some news on this.
@NikolaDeveloper Here’s a one line fix / workaround for React:
It basically just calls
updateon IonSlides after loading. It’s nice because it doesn’t need any ref or additional variable.Good hint. I was able to fix it with the following exemplary workaround for my use case.
Edit: In case this workaround don’t work, check this one.
Fixed it with the ionViewDidEnter hook instead:
I was able to reproduce this bug in Ionic 4.10.0, so it doesn’t seem like a 4.11 regression. I’m going to dig into this a bit more and see where the bug originally appeared.
I can confirm the bug with the StackBlitz example as I am also affected by the linked issue for the react package.
Unfortunately, the error really occurs randomly and cannot really be reproduced . You can try to swipe back and forward several times with e.g. pressed mouse button, close modal and open it again and redo some swiping. Repeat the process multiple times until the bug appears.
Example where it happens after the first try:
Hi,
I am hiding your comment as it is off topic and not constructive to getting this issue resolved. I will try to take a look at this issue this week.
We have acknowledged this is an issue here. We are looking into a resolution; however, since it appears randomly it is a bit tricky to resolve. Additionally, a few users on this thread have provided temporary workarounds. I will post another update here when I have more information to share.
Thanks!
My issue is slides will not swipe in a modal when it is first opened. Open the modal again, the slides works.
Following the above suggest, I solved the issue simply by adding a .update() call:
Don’t know why.
Hi everyone,
This was resolved via https://github.com/ionic-team/ionic-framework/pull/24257 and a fix will be available in an upcoming release of Ionic. This fix will be available in both Ionic 5 and Ionic 6. Thanks!
@netsesame2 thanks for the hint, looks like it worked for me
+1 to this issue tho I’m having this on React. Doesn’t work on iOS but does in browser