mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(refresher): get scrollTop from the scroll element to prevent refreshing when dragging up
fixes #5207
This commit is contained in:
@ -299,10 +299,10 @@ export class Refresher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.state === STATE_INACTIVE) {
|
if (this.state === STATE_INACTIVE) {
|
||||||
// this refresh is not alreadying actively pulling down
|
// this refresh is not already actively pulling down
|
||||||
|
|
||||||
// get the content's scrollTop
|
// get the content's scrollTop
|
||||||
let scrollHostScrollTop = this._content.getScrollTop();
|
let scrollHostScrollTop = this._content.scrollElement.scrollTop;
|
||||||
|
|
||||||
// if the scrollTop is greater than zero then it's
|
// if the scrollTop is greater than zero then it's
|
||||||
// not possible to pull the content down yet
|
// not possible to pull the content down yet
|
||||||
|
@ -8,30 +8,30 @@ class E2EApp {
|
|||||||
items = [];
|
items = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
for (var i = 0; i < 3; i++) {
|
for (var i = 0; i < 15; i++) {
|
||||||
this.items.push( getRandomData() );
|
this.items.push( getRandomData() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doRefresh(refresher) {
|
doRefresh(refresher) {
|
||||||
console.log('Begin async operation');
|
console.info('Begin async operation');
|
||||||
|
|
||||||
getAsyncData().then(newData => {
|
getAsyncData().then(newData => {
|
||||||
for (var i = 0; i < newData.length; i++) {
|
for (var i = 0; i < newData.length; i++) {
|
||||||
this.items.unshift( newData[i] );
|
this.items.unshift( newData[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Finished receiving data, async operation complete');
|
console.info('Finished receiving data, async operation complete');
|
||||||
refresher.endRefreshing();
|
refresher.endRefreshing();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doStart(refresher) {
|
doStart(refresher) {
|
||||||
console.log('Refresher, start');
|
console.info('Refresher, start');
|
||||||
}
|
}
|
||||||
|
|
||||||
doPulling(refresher) {
|
doPulling(refresher) {
|
||||||
console.log('Pulling', refresher.progress);
|
console.info('Pulling', refresher.progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -82,4 +82,4 @@ const data = [
|
|||||||
'Next',
|
'Next',
|
||||||
'Kick-Ass',
|
'Kick-Ass',
|
||||||
'Drive Angry'
|
'Drive Angry'
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user