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.

Ion slides width takes full screen width on second visit to page that has the slides

See original GitHub issue

Bug Report

Ionic version:

[ ] 4.x [x] 5.3.0

Current behavior: On first visit to page that has slides, the slides are the correct width as per “slides per page”. If I navigate away and come back each slide takes the full screen width. The slides are also very slow to load, taking as much as 5 seconds. I am using saved icons in the slides so it is not the images in the slides causing the lag. BUT THE MAIN ISSUE IS THE WIDTH. I have just updated from ionic 4.4.0 and there were no problems, and I have not changed any code relating to the slides.

Expected behavior: the slides should be the correct width as per “slides per page”

Steps to reproduce: Steps as described above.

Related code:

@ViewChild('slides', { static: true }) slides: any;

   sliderOptions = {
    zoom: false,
    slidesPerView: 6,
    initialSlide: 2,
    centeredSlides: true,
    spaceBetween: 6
  };

<ion-slides [options]="sliderOptions" #slides style="background-color: var(--ion-color-medium-tint)">
    <ion-slide *ngFor="let pathStep of pathStepsArray; let i = index">
      <ion-grid class="ion-no-padding">
        .....
      </ion-grid>
    </ion-slide>
  </ion-slides>

Other information: Turning off ivy by adding following to tsconfig.app.json and running ionic serve doesn’t help. Is this issue related to this other (resolved) bug: https://github.com/ionic-team/ionic-framework/issues/20356

"angularCompilerOptions": {
    "enableIvy": false
  }

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.7.1 (C:\Users\xxx\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.3.0
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   capacitor (Capacitor CLI) : not installed
   @capacitor/core           : not installed

Cordova:

   cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
   Cordova Platforms     : none
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.1.4, (and 11 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\xxx\AppData\Local\Android\sdk)
   NodeJS            : v12.16.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.13.4
   OS                : Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ReaperTechcommented, Jul 31, 2020

Yes, that issue was fixed several versions ago. It looks like you are using Ionic Framework v5.3.0, so you already have that fix.

Unfortunately, I cannot fix the issue without being able to reproduce it on my end. If you can find a way to reproduce the issue in a GitHub repo that would be great, otherwise I am going to have to close this issue. Thanks!

I will try again to reproduce

0reactions
liamdebeasicommented, Aug 13, 2020

Hi there,

I am going to close this issue as I am unable to reproduce the issue you are describing. If you are able to provide a GitHub repo that showcases the issue, please feel free to create a new bug report. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ion-slide style width is set automatically - Stack Overflow
Specific widths are being set in the style tags on the slides when the app loads, and it's breaking my styles. This is...
Read more >
Ionic 4 ion-slide width is wrong
In case of short slide content, the slide is shorter then the screen. It won't set to full width, eventhough it's only supposed...
Read more >
Building a slideshow with Ionic Slides API - Mastering Ionic
In this coding tutorial we will walk through using the Ionic Slides API to create stunning slideshow components for our mobile applications ...
Read more >
Resized Ionic Slides - CodePen
<link href="//code.ionicframework.com/1.2.4/css/ionic.css" rel="stylesheet"> ... <ion-slides options="options" slider="data.slider">. 16. <ion-slide-page>.
Read more >
Video: Change list formatting on the slide master
Training: You want to change the bullets formatting everywhere, not just on one or two slides. So make all changes on the slide...
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