Hello,
I have updated ionic 4.0.2 to ionic 4.0.3 and a problem came with this update.
When i try to get the scroll amount through “ev.detail.scrollTop” i always get 0.
So i tried to create a new project to see if the problem was caused by my project, but even in this project i got the same error. So here is the code of the new project, easier to read :
home.page.html :
<ion-header>
<ion-toolbar>
<ion-title>Home</ion-title>
</ion-toolbar>
</ion-header>
<ion-content (ionScroll)="scroll($event)" [scrollEvents]="true">
The world is your oyster.
<!-- scrollable content-->
</ion-content>
home.page.ts :
import {Component, OnInit, ViewChild} from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss']
})
export class HomePage {
scroll(ev) {
console.log('scroll event scrollTop', ev.detail.scrollTop);
console.log('scroll event detail', ev.detail);
}
}
And here is what i get on the console.log :
For ev.detail.scrollTop :
0
For ev.detail :
{scrollTop: 0, scrollLeft: 0, type: “scroll”, event: Event, startX: 0, …}
currentX:0
currentY:0
data:undefined
deltaX:0
deltaY:0
event:Event {isTrusted: true, type: “scroll”, target: null, currentTarget: null, eventPhase: 0, …}
isScrolling:true
scrollLeft:0
scrollTop:0
startTimeStamp:3641.8999999987136
startX:0
startY:0
timeStamp:3819.5999999989
type:“scroll”
velocityX:0
velocityY:0
proto:Object
As it is my first post on this forum, i hope i’m enough clear so you can understand my problem.
EDIT : I downgraded to ionic 4.0.2, and all is working great, so it seems to be a bug on the version 4.0.3 only.