Disable ios swipe to go back for specific views

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:

3 Likes

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.

10 Likes

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

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

ok great, thanks for the info.

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.

+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.

1 Like

+1

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

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:

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.

A solution is offered here:

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

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

1 Like

Worked great thank you

Thank you <3!!! ! ! ! !

1 Like