Ionic-framework: Slides with vertical direction breaks when screen orientation is changed

Created on 14 Feb 2017  路  10Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x (2.0.0, 2.0.1 tested)

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

when using ion-slides with direction="vertical" breaks when screen orientation changes. It's fine without direction="vertical" option.

Expected behavior:

After changing orientation, slides should adjust the inner content position to fit the screen.

Steps to reproduce:
https://forum.ionicframework.com/t/slides-with-orientation-change/79460/4

Related code:

<ion-slides #oneSlider *ngIf="getSettings().read === 'one'"
    direction="vertical"
    pager="true"
    paginationType="progress"
    zoom="true"
    [effect]="getSettings().effect"
    (ionSlideDidChange)="slideChange()"
    (click)="touchHelp()">
    <ion-slide *ngFor="let item of getItemList()" (swipe)="swipeEvent($event)" (press)="pressEvent($event)">
        <div class="home-content">
            {{ item }}
        </div>
    </ion-slide>
</ion-slides>

Other information:

https://forum.ionicframework.com/t/slides-with-orientation-change/79460/4

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here
v3

All 10 comments

i had this working in RC3. but broken in 2.0.0 and 2.0.1.

@mhartington FYI.

Hello, thanks for using Ionic! We will look into this.

@jgw96 any update on this?

Hi, we will look at it when we get to it.
It's on our list of TODOs.

We will update you when we address it.
Please refrain from pinging 馃槃

it's been a year and still this seems a problem.

+1

I fixed this by modify node_modules/ionic-angular/components/slides/swiper/swiper.js
line: 285~288

if (typeof s.renderedHeight !== 'undefined') {
    // manually assign user height
    height = s.renderedHeight;
}

change to

if (typeof s.height !== 'undefined') {
    // manually assign user height
    height = s.height;
}

Not the best way, but this can fix problem temporary.

ionic angular version: 3.8.0

This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know!

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

giammaleoni picture giammaleoni  路  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

fdnhkj picture fdnhkj  路  3Comments

danbucholtz picture danbucholtz  路  3Comments