Skip to content

Commit

Permalink
feat(scroll): Native scrolling default. Closes #4725
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Dec 6, 2015
1 parent cfa8042 commit 11946ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion js/angular/directive/content.js
Expand Up @@ -71,7 +71,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
element.addClass('scroll-content-false');
}

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

// collection-repeat requires JS scrolling
if (nativeScrolling) {
Expand Down
8 changes: 4 additions & 4 deletions js/angular/service/ionicConfig.js
Expand Up @@ -91,9 +91,9 @@
/**
* @ngdoc method
* @name $ionicConfigProvider#scrolling.jsScrolling
* @description Whether to use JS or Native scrolling. Defaults to JS scrolling. Setting this to
* `false` has the same effect as setting each `ion-content` to have `overflow-scroll='true'`.
* @param {boolean} value Defaults to `true`
* @description Whether to use JS or Native scrolling. Defaults to native scrolling. Setting this to
* `true` has the same effect as setting each `ion-content` to have `overflow-scroll='false'`.
* @param {boolean} value Defaults to `false` as of Ionic 1.2
* @returns {boolean}
*/

Expand Down Expand Up @@ -309,7 +309,7 @@ IonicModule
},

scrolling: {
jsScrolling: true
jsScrolling: false
},

spinner: {
Expand Down
11 changes: 10 additions & 1 deletion js/views/scrollViewNative.js
Expand Up @@ -18,6 +18,16 @@
self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);
self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);

if(options.startY >= 0 || options.startX >= 0) {
ionic.requestAnimationFrame(function() {
self.el.scrollTop = options.startY || 0;
self.el.scrollLeft = options.startX || 0;

self.__scrollTop = self.el.scrollTop;
self.__scrollLeft = self.el.scrollLeft;
})
}

self.options = {

freeze: false,
Expand Down Expand Up @@ -459,4 +469,3 @@
});

})(ionic);

0 comments on commit 11946ef

Please sign in to comment.