Disable ios swipe to go back for specific views


#1

Hi,

I am wondering if there is a simple way to disable swipe to go back for specific views? Maybe it’s simpler to disable it for all views and then only allow it on certain views.

Where can I find documentation on this?

Thanks in advance! :slight_smile:


Can-swipe-back="false" doesn't work to prevent iOS swipe back
V1.0.0-rc.0: How to disable swipe to go back?
Swipe Back view
#2

Ok, I worked out from existing documentation to add this code to my app.js:

// let's turn off swipe to go back

app.config(function($ionicConfigProvider) {
$ionicConfigProvider.views.swipeBackEnabled(false);
});

I would like to enable it on one or more views though if possible.


#3

+1
I have one page that uses a fullscreen slide box. It does not play nice in combination with slide to go back…


#4

currently you can only have the whole feature enabled or disabled, rather than enabled only for specific views


#5

ok great, thanks for the info.


#6

Yes, that would be a great option.

I would like to disable it on forms, where I have implemented a confirmation before closing/moving away from the view.


#7

+1

You must be able to turn off this feature whenever because it’s sometimes overriding everything that otherwise prevents a “go back” event. Like the hardware back on Android is prevented easily. But not iOS swipe to go back. makes no sense.


#8

+1

I would like to be able to enable or disable the swipe to go back feature per view.


#9

it is weird, but in my case, if page caching is disabled this “back swipe” delete(or do not load) data on the page and page shows blank…also if you do not finished your move, it do not reload previous page state. :worried:
I did not know about adding this function and my glitchy app in App Store now :sweat_smile:


#10

I unfortunately had to disable this awesome feature (for now) in our mobile app b/c we have a view that toggles between a list and map and as you drag around the map it’s very easy to swipe back to the previous view.


#11

A solution is offered here:

https://github.com/driftyco/ionic/issues/3470#issuecomment-100291172#

Use can-swipe-back=“false” on your ion-view element.


#12

Worked great thank you


#13

Thank you <3!!! ! ! ! !