Skip to content

Commit

Permalink
Revert "feat(scroll): disable body scroll on iOS safari"
Browse files Browse the repository at this point in the history
This reverts commit 5875ebc.
  • Loading branch information
mlynch committed Dec 15, 2015
1 parent 5875ebc commit 3d866a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 43 deletions.
3 changes: 1 addition & 2 deletions js/angular/directive/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 4 additions & 10 deletions js/angular/service/ionicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ IonicModule
toggle: PLATFORM
},
scrolling: {
jsScrolling: PLATFORM,
disableBodyBounce: PLATFORM
jsScrolling: PLATFORM
},
spinner: {
icon: PLATFORM
Expand Down Expand Up @@ -310,8 +309,7 @@ IonicModule
},

scrolling: {
jsScrolling: false,
disableBodyBounce: false
jsScrolling: false
},

spinner: {
Expand All @@ -326,18 +324,14 @@ IonicModule
templates: {
maxPrefetch: 30
}

});



// iOS (it is the default already)
// -------------------------
setPlatformConfig('ios', {
scrolling: {
jsScrolling: false,
disableBodyBounce: true
}
});
setPlatformConfig('ios', {});



Expand Down
31 changes: 0 additions & 31 deletions js/views/scrollViewNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand All @@ -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;
Expand Down

1 comment on commit 3d866a0

@jeveloper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a hot patch for 1.2?
thanks Max

Please sign in to comment.