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.

Ionic v4: Virtual Scroll does not work inside of an ion-tab

See original GitHub issue

Bug Report

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

cli packages: (/usr/local/lib/node_modules)

   @ionic/cli-utils  : 2.0.0-rc.6
   ionic (Ionic CLI) : 4.0.0-rc.6

local packages:

   @angular-devkit/core       : 0.6.0
   @angular-devkit/schematics : 0.6.0
   @angular/cli               : 6.0.1
   @ionic/schematics-angular  : 1.0.0-rc.6
   Ionic Framework            : @ionic/angular 4.0.0-alpha.7

System:

   NodeJS : v8.11.2
   npm    : 6.0.1
   OS     : macOS High Sierra

Describe the Bug ion-virtual-scroll does not load any elements when used inside an ion-tab.

Steps to Reproduce Steps to reproduce the behavior:

  1. Generate a new Ionic v4 project with the tabs template.
  2. Add a ion-virtual-scroll element following the Ionic 4 example inside one of the tab page components. See that this virtual scroll doesn’t load any children and throws no errors.
  3. Remove the ion-tab that wraps the ion-router-outlet
  4. See that the virtual scroll items now load.

Related Code This doesn’t work:

<ion-tabs>
  <ion-tab label="Home" icon="home" href="/tabs/(home:home)">
    <ion-router-outlet name="home"></ion-router-outlet>
  </ion-tab>
</ion-tabs>
screen shot 2018-06-07 at 3 32 30 pm

This does:

<ion-tabs>
	<ion-router-outlet name="home"></ion-router-outlet>
</ion-tabs>
screen shot 2018-06-07 at 3 34 38 pm

Expected Behavior ion-virtual-scroll should work inside of a ion-tab

Additional Context After poking around in https://github.com/ionic-team/ionic/blob/51c2aa69a29dec1f2bb76c1b7387716b7872fd4b/core/src/components/virtual-scroll/virtual-scroll.tsx#L366. this.scrollEl.offsetHeight logs out at 0 when wrapped in the ion-tab, but returns the correct height when not. For some reason even though the ion-scroll element exists, it has 0 height when inside the ion-tab. Wrapping the onResize() method and the scrollEl.componentOnReady() callback in a setTimeout(() => {}) fixes the issue, but seems like a hacky solution.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
faraazccommented, Jun 8, 2018

@manucorporat @mlynch @adamdbradley Please consider virtual-scroll + infinite scroll bugs seriously as they basic necessary feature required for the maximum data-driven Apps. Ionic 2 and 3 implementations did not justify the needs, as a result, many devs moved to native frameworks after waiting for a long time. As a community, we tried to solve this problem but with less expertise, it was hard to achieve. It will be great if V4 does not appoint and Ionic would consider VS + infinite scroll seriously and high prioritize them. This request is not just from me but from 25 other fellow devs who love Ionic and love to use Ionic for every idea/business/implementation.

Last but not least Thanks for providing Ionic which is the best gift web community has received so far.

Thanks

0reactions
ionitron-bot[bot]commented, Jan 12, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-virtual-scroll - Ionic Framework
ion -virtual-scroll. Virtual Scroll displays a virtual, "infinite" list. An array of records is passed to the virtual scroll containing the data to...
Read more >
Content scroll is not working when using ion-tabs in ionic 4
Its seems to halt the screen not able to scroll screen. dashboard.component.html. <app-header></app-header> ...
Read more >
How to use Angular Virtual Scroll with Ionic - YouTube
The Ionic virtual scroll component was deprecated with Ionic 6, but we can easily transition to the Angular virtual scroll implementation to ...
Read more >
Ionic 5 horizontal scroll
I am trying to do virtual scrolling on ionic 4 to display two column list, ... inside an ion-scroll element, scrolling is not...
Read more >
Ionic Snippets - Open VSX Registry
All code snippets are based on and follow the Ionic 5 Api and Ionic 4 Api ... i-virtual-scroll-w-header, <ion-virtual-scroll> with header function ......
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