Ion slides width takes full screen width on second visit to page that has the slides
See original GitHub issueBug 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:
- Created 3 years ago
- Comments:10 (3 by maintainers)
I will try again to reproduce
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!