Skip to content

Commit 90e7395

Browse files
committed
fix($ionicLoading): do not flicker when showing long loading messages
Closes #1252
1 parent efa6184 commit 90e7395

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Diff for: js/angular/service/loading.js

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c
118118
ionic.DomUtil.centerElementByMarginTwice(self.element[0]);
119119
ionic.requestAnimationFrame(function() {
120120
self.isShown && self.element.addClass('active');
121+
ionic.DomUtil.centerElementByMarginTwice(self.element[0]);
121122
});
122123
}
123124
});

Diff for: js/utils/dom.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@
204204
centerElementByMarginTwice: function(el) {
205205
ionic.requestAnimationFrame(function() {
206206
ionic.DomUtil.centerElementByMargin(el);
207-
ionic.requestAnimationFrame(function() {
207+
setTimeout(function() {
208208
ionic.DomUtil.centerElementByMargin(el);
209+
setTimeout(function() {
210+
ionic.DomUtil.centerElementByMargin(el);
211+
});
209212
});
210213
});
211214
},

Diff for: test/html/loading.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
.controller('LoadingCtrl', function($scope, $ionicLoading) {
1919
$scope.startLoading = function() {
2020
$ionicLoading.show({
21-
template: 'Getting current location...',
21+
template: '<div>Connection problem.</div><br/><div>Please check your internet connection!</div>',
2222
delay: 100,
23-
duration: 500
23+
duration: 3000
2424
});
2525
};
2626
});

0 commit comments

Comments
 (0)