Ionic-framework: SwipeBackEnabled on modals Ionic 2

Created on 9 Apr 2016  路  11Comments  路  Source: ionic-team/ionic-framework

Hi, is there any way how to disable swipe-back on specific page in Ionic 2 ? I have Modal that goes down when swiping to go back which is annoying. Help ?
I tried both:

swipe-back-enabled="false"
can-swipe-back="false"

but doesnt work. I tried going through the code but I am not able to find how to fix this.. if i set swipe-back-enabled to false it works for normal pages (nav.push), but it doesnt for modals

Most helpful comment

All 11 comments

I'm wondering the same thing, the swipe-back function is a bit buggy right now (e.g. the page that it beiing swiped away is still scrollable) so I'd like to be able to disable it globally.

Seems this one and #6117 are pretty much related... :)

@denkomanceski @danielcrk-cn the correct attribute is swipeBackEnabled.

<ion-nav id="nav" [root]="root" #content swipeBackEnabled="false"></ion-nav>

for me the swiping freezes a lot, is this related?
screen shot 2016-04-26 at 16 49 24

@manucorporat unfortunately swipeBackEnabled="false" does not work for me, swipeBack is still enabled. Have you successfully managed to disable it?

My ion-nav-component looks like this:
<ion-nav id="nav" [root]="rootPage" swipeBackEnabled="false"></ion-nav>

Does anyone have a solution to disable swipe to go back entirely? Even if it is a temporary one. Having a map on a page does not play well with this feature. Ill even edit the ionic.js file if I need to. I just don't know where to look.

I can confirm that the below code does not work:
<ion-nav id="nav" [root]="rootPage" swipeBackEnabled="false"></ion-nav>

hi @iaguilera14 can you make a plunker demonstrating that swipeBackEnabled does not work?
I am very busy fixing some issues for next release and it would really help me!

You can start from the template: http://plnkr.co/edit/me3Uk0GKWVRhZWU0usad?p=preview

No problem @manucorporat . I was able to reproduce it simply by switching the application to a tabs setup. I used the supplied tabs.ts and tabs.html. It seems that the swipeBackEnabled works when not using tabs, but is overridden when using tabs. Perhaps because tabs have their own navigation stack?

http://plnkr.co/edit/fB3VofAwyYoFcEF009Co

Note: I was using mobile safari on an iPhone to test this plunker. Let me know if there is a way around this for now. I can't seem to find one. I tried adding swipeBackEnabled to the actual tabs component and that didn't seem to work either.

@manucorporat Awesome! Thanks!

Hello all, since it looks like this was fixed by @manucorporat i will be closing this issue. Thanks for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alan-agius4 picture alan-agius4  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

vswarte picture vswarte  路  3Comments

masimplo picture masimplo  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments