Skip to content

Commit 11946ef

Browse files
committed
feat(scroll): Native scrolling default. Closes #4725
1 parent cfa8042 commit 11946ef

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Diff for: js/angular/directive/content.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
7171
element.addClass('scroll-content-false');
7272
}
7373

74-
var nativeScrolling = attr.overflowScroll === "true" || !$ionicConfig.scrolling.jsScrolling();
74+
var nativeScrolling = attr.overflowScroll !== "false" && (attr.overflowScroll === "true" || !$ionicConfig.scrolling.jsScrolling());
7575

7676
// collection-repeat requires JS scrolling
7777
if (nativeScrolling) {

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@
9191
/**
9292
* @ngdoc method
9393
* @name $ionicConfigProvider#scrolling.jsScrolling
94-
* @description Whether to use JS or Native scrolling. Defaults to JS scrolling. Setting this to
95-
* `false` has the same effect as setting each `ion-content` to have `overflow-scroll='true'`.
96-
* @param {boolean} value Defaults to `true`
94+
* @description Whether to use JS or Native scrolling. Defaults to native scrolling. Setting this to
95+
* `true` has the same effect as setting each `ion-content` to have `overflow-scroll='false'`.
96+
* @param {boolean} value Defaults to `false` as of Ionic 1.2
9797
* @returns {boolean}
9898
*/
9999

@@ -309,7 +309,7 @@ IonicModule
309309
},
310310

311311
scrolling: {
312-
jsScrolling: true
312+
jsScrolling: false
313313
},
314314

315315
spinner: {

Diff for: js/views/scrollViewNative.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);
1919
self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);
2020

21+
if(options.startY >= 0 || options.startX >= 0) {
22+
ionic.requestAnimationFrame(function() {
23+
self.el.scrollTop = options.startY || 0;
24+
self.el.scrollLeft = options.startX || 0;
25+
26+
self.__scrollTop = self.el.scrollTop;
27+
self.__scrollLeft = self.el.scrollLeft;
28+
})
29+
}
30+
2131
self.options = {
2232

2333
freeze: false,
@@ -459,4 +469,3 @@
459469
});
460470

461471
})(ionic);
462-

0 commit comments

Comments
 (0)