fix(refresher): get scrollTop from the scroll element to prevent refreshing when dragging up

fixes #5207
This commit is contained in:
Brandy Carney
2016-02-29 13:48:36 -05:00
parent f905e18a80
commit ea884ded6d
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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'
]; ];