From 3d866a0187a9ead876cc8aed9cad38b950b63c3d Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 14 Dec 2015 21:05:22 -0600 Subject: [PATCH] Revert "feat(scroll): disable body scroll on iOS safari" This reverts commit 5875ebcb57a7712ca110a4f3d6d395b1f5e8723f. --- js/angular/directive/content.js | 3 +-- js/angular/service/ionicConfig.js | 14 ++++---------- js/views/scrollViewNative.js | 31 ------------------------------- 3 files changed, 5 insertions(+), 43 deletions(-) diff --git a/js/angular/directive/content.js b/js/angular/directive/content.js index b7bff0f30f2..6e53f3dcb84 100644 --- a/js/angular/directive/content.js +++ b/js/angular/directive/content.js @@ -132,8 +132,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) { delegateHandle: attr.delegateHandle, startX: $scope.$eval($scope.startX) || 0, startY: $scope.$eval($scope.startY) || 0, - nativeScrolling: true, - disableBodyBounce: $ionicConfig.scrolling.disableBodyBounce() + nativeScrolling: true }; } else { diff --git a/js/angular/service/ionicConfig.js b/js/angular/service/ionicConfig.js index f5bf724dd92..e726aff094c 100644 --- a/js/angular/service/ionicConfig.js +++ b/js/angular/service/ionicConfig.js @@ -260,8 +260,7 @@ IonicModule toggle: PLATFORM }, scrolling: { - jsScrolling: PLATFORM, - disableBodyBounce: PLATFORM + jsScrolling: PLATFORM }, spinner: { icon: PLATFORM @@ -310,8 +309,7 @@ IonicModule }, scrolling: { - jsScrolling: false, - disableBodyBounce: false + jsScrolling: false }, spinner: { @@ -326,18 +324,14 @@ IonicModule templates: { maxPrefetch: 30 } + }); // iOS (it is the default already) // ------------------------- - setPlatformConfig('ios', { - scrolling: { - jsScrolling: false, - disableBodyBounce: true - } - }); + setPlatformConfig('ios', {}); diff --git a/js/views/scrollViewNative.js b/js/views/scrollViewNative.js index 67ffe42a515..b49bc93df88 100644 --- a/js/views/scrollViewNative.js +++ b/js/views/scrollViewNative.js @@ -441,26 +441,6 @@ self.resize(); }; - var startY = 0; - var curY = 0; - var height = 0; - self.handleWindowTouchStart = function(e) { - startY = e.touches ? e.touches[0].screenY : e.screenY; - height = self.el.offsetHeight; - }; - - self.handleWindowTouchMove = function(e) { - curY = e.touches ? e.touches[0].screenY : e.screenY; - - var atTop = (startY <= curY && self.el.scrollTop === 0); - var atBottom = (startY >= curY && self.el.scrollHeight - self.el.scrollTop === height); - - if(atTop || atBottom) { - // Disable body bounce - e.preventDefault(); - } - }; - container.addEventListener('scroll', self.onScroll); //Broadcasted when keyboard is shown on some platforms. @@ -473,12 +453,6 @@ // Since we can only resize scroll views that are currently visible, just resize // the current scroll view when the keyboard is closed. document.addEventListener('resetScrollView', self.resetScrollView); - - if(self.options.disableBodyBounce && !ionic.Platform.isWebView()) { - window.addEventListener('touchstart', self.handleWindowTouchStart); - window.addEventListener('touchmove', self.handleWindowTouchMove); - } - }, __cleanup: function() { @@ -491,11 +465,6 @@ container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView); container.removeEventListener('resetScrollView', self.resetScrollView); - if(self.options.disableBodyBounce && !ionic.Platform.isWebView()) { - window.removeEventListener('touchstart', self.handleWindowTouchStart); - window.removeEventListener('touchmove', self.handleWindowTouchMove); - } - ionic.tap.removeClonedInputs(container, self); delete self.__container;