Infinite scroll stopped working.
See original GitHub issueDescription: Ionic Infinite scroll is no longer working.
Steps to Reproduce: Simply start a new tabs project - ionic start myApp tabs
In tab2.page.html add:
<ion-header>
<ion-toolbar>
<ion-title>
Tab Two
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-button (click)="toggleInfiniteScroll()" expand="block">
Toggle Infinite Scroll
</ion-button>
<ion-list>
<ion-item *ngFor="let i of items">{{i}}</ion-item>
</ion-list>
<ion-infinite-scroll (ionInfinite)="loadData($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="Loading more data...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
In tab2.page.ts add
import { Component, ViewChild } from '@angular/core';
import { IonInfiniteScroll } from '@ionic/angular';
@Component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss']
})
export class Tab2Page {
items = [];
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
constructor() {
for (let i = 0; i < 30; i++) {
this.items.push( this.items.length );
}
}
loadData(event) {
console.log('Begin async operation');
setTimeout(() => {
for (let i = 0; i < 30; i++) {
this.items.push( this.items.length );
}
console.log('Done');
event.target.complete();
// App logic to determine if all data is loaded
// and disable the infinite scroll
if (this.items.length == 1000) {
event.target.disabled = true;
}
}, 500);
}
toggleInfiniteScroll() {
this.infiniteScroll.disabled = !this.infiniteScroll.disabled;
}
}
Then save and run ionic serve.
Output:
The infinite scroll just does not work. The loadData method never gets fired. I have also tested on ios and the same problem occurs. I am on ionic 5.2.1, I have also tried with earlier versions and same result.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
ngInfiniteScroll not working - Stack Overflow
Scroll event is only triggered on page load, after that nothing seems to trigger it. Can anyone please shed some light. I tried...
Read more >Infinite scroll stopped working - WordPress.org
Hello,. Since yesterday the infinite scroll option has stopped working. The website went live over 1 month ago and it had been working...
Read more >Infinite scroll not working - Get Help - Frontity Community Forum
Hello guys, I am trying to build a site using frontity with infinite scroll feature on the site, but I am stuck at...
Read more >Infinite scroll not working correctly - Toolset
Hi For some reason when I enable infinite scroll when you get down to the bottom it swaps out the content that's already...
Read more >Infinite scroll not working · Issue #1685 · vueuse ... - GitHub
You should ensure the scroll container height < scroll content height.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi there,
This is a known issue with 4.6.0. We are preparing a 4.6.1 release that addresses this issue and hope to have it out soon.
I am going to close this issue in favor of the main 4.6.0 bug tracker: https://github.com/ionic-team/ionic/issues/18655
Thanks!
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.