Skip to content

Commit

Permalink
fix(navigation): swipe-to-go-back on a per-view basis in iOS issue #4574
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Bucholtz committed Apr 6, 2016
1 parent 5d80cb1 commit c375b6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/angular/controller/navViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
$scope.$on('$ionicTabs.leave', onTabsLeave);

ionic.Platform.ready(function() {
if (ionic.Platform.isWebView() && $ionicConfig.views.swipeBackEnabled()) {
self.initSwipeBack();
}
self.initSwipeBack();
});

return viewData;
Expand Down Expand Up @@ -355,6 +353,10 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
function onDragStart(ev) {
if (!isPrimary) return;

if ( !$ionicConfig.views.swipeBackEnabled() || ! ionic.Platform.isIOS() ){
return;
}

startDragX = getDragX(ev);
if (startDragX > swipeBackHitWidth) return;

Expand Down
10 changes: 10 additions & 0 deletions js/angular/service/ionicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
* @returns {boolean}
*/

/**
* @ngdoc method
* @name $ionicConfigProvider#views.swipeBackEnabled
* @description By default on iOS devices, swipe to go back functionality is enabled by default.
* This method can be used to disable it globally, or on a per-view basis.
* Note: This functionality is only supported on iOS.
* @param {boolean} value
* @returns {boolean}
*/

/**
* @ngdoc method
* @name $ionicConfigProvider#scrolling.jsScrolling
Expand Down

0 comments on commit c375b6e

Please sign in to comment.