mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(refresher): finish animating before changing icon, hide when not in use
This commit is contained in:
20
js/angular/controller/scrollController.js
vendored
20
js/angular/controller/scrollController.js
vendored
@@ -20,6 +20,8 @@ IonicModule
|
||||
function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $location, $rootScope, $document, $ionicScrollDelegate) {
|
||||
|
||||
var self = this;
|
||||
// for testing
|
||||
this.__timeout = $timeout;
|
||||
|
||||
this._scrollViewOptions = scrollViewOptions; //for testing
|
||||
|
||||
@@ -188,14 +190,28 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
|
||||
var refresher = this.refresher = refresherElement;
|
||||
var refresherHeight = self.refresher.clientHeight || 0;
|
||||
scrollView.activatePullToRefresh(refresherHeight, function() {
|
||||
// activateCallback
|
||||
refresher.classList.add('active');
|
||||
refresherScope.$onPulling();
|
||||
}, function() {
|
||||
refresher.classList.remove('refreshing');
|
||||
refresher.classList.remove('active');
|
||||
// deactivateCallback
|
||||
$timeout(function(){
|
||||
refresher.classList.remove('active');
|
||||
refresher.classList.remove('refreshing');
|
||||
refresher.classList.add('invisible');
|
||||
},300);
|
||||
}, function() {
|
||||
// startCallback
|
||||
refresher.classList.add('refreshing');
|
||||
refresherScope.$onRefresh();
|
||||
},function(){
|
||||
// showCallback
|
||||
refresher.classList.remove('invisible');
|
||||
console.log('showing')
|
||||
},function(){
|
||||
// hideCallback
|
||||
refresher.classList.add('invisible');
|
||||
console.log('hiding');
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user