question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion-slides regression in modals (unusable after 4.11.0)

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:39 (9 by maintainers)

github_iconTop GitHub Comments

14reactions
FranzSwcommented, Mar 2, 2020

Would love to hear some news on this.

@NikolaDeveloper Here’s a one line fix / workaround for React:

// ...
<IonSlides onIonSlidesDidLoad={function(this: any){this.update()}}>
//...

It basically just calls update on IonSlides after loading. It’s nice because it doesn’t need any ref or additional variable.

10reactions
SimonGolmscommented, Feb 11, 2020

One thing to note is that the bug can be fixed whenever it occurs by simply triggering a window resize

Good hint. I was able to fix it with the following exemplary workaround for my use case.

// slides-modal.component.html
...
<ion-content>
  <ion-slides #sliderRef>
    <ion-slide>
       ...
    </ion-slide>
  </ion-slides>
</ion-content>
...
// slides-modal.component.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { ModalController, IonSlides } from '@ionic/angular';

@Component({
  selector: 'app-slides-modal',
  templateUrl: './slides-modal.component.html',
  styleUrls: ['./slides-modal.component.scss']
})
export class SlidesModalComponent implements OnInit {

  @ViewChild('sliderRef', { static: true }) protected slides: IonSlides;

  constructor(private modalController: ModalController) {}

  ngOnInit() {
    this.slides.update();
  }
}

Edit: In case this workaround don’t work, check this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ion-slides regression in modals (unusable after 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 ...
Read more >
Why Did Ionic 4 Ion-Slides Suddenly Stop Displaying Properly?
Through more extensive bug testing, I found out that the problem was not with ion-slides, but actually with page loading.
Read more >
Ion-Slides: Mobile Touch Slider with Built-In & Custom Animation
Ion-Slides is a multi-section container which offers custom and built-in mobile touch slider animation effects. See how Ion-Slides works with iOS and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found