ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.02k stars 13.51k forks source link

bug: Virtual Scroll + phone orientation #19014

Closed JumBay closed 3 years ago

JumBay commented 5 years ago

Bug Report

Ionic version:

[x] 4.x

Current behavior:

As you can see in this gif, if you change the phone orientation from portrait to landscape and then go back to portrait, you won't be able to scroll to the first elements anymore: Screen Recording 2019-08-06 at 22 54 35

This seems to be the same issue as https://github.com/ionic-team/ionic/issues/13392 but on ionic 4

Expected behavior:

Should be able to scroll to the first Element again

Steps to reproduce:

clone this https://github.com/JumBay/ionic-virtualscroll-issue or Create a brand new project with tabs options, edit tab1.page.ts and tab2.page.ts with this code:

import { Component } from '@angular/core';

@Component({
  selector: 'app-tab1',
  template: `
  <ion-header>
  <ion-toolbar>
    <ion-title>
      Tab One
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-virtual-scroll [items]="items">
    <ion-item *virtualItem="let item">
      <div>{{item}}</div>
    </ion-item>
  </ion-virtual-scroll>
</ion-content>
  `,

  styles: [
    `div {
      background: rgb(189, 72, 72);
      width: 60px;
      height: 60px;
      text-align: center;
      color: white;
    }`
  ]
})
export class Tab1Page {

  items = [];

  constructor() {
    for (let i = 0; i < 1000; i++) {
      this.items.push(i);
    }
  }

}

Run the code on an iOS simulator/device

Ionic info:


Ionic:

   Ionic CLI                     : 5.2.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.3
   @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 : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.3 (update available: 0.2.8)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.16.0 (/usr/local/bin/node)
   npm        : 6.9.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.3 Build version 10G8
JumBay commented 3 years ago

close it because ion-virtual-scroll will be removed in next releases

ionitron-bot[bot] commented 3 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.