Disabling Swipe gestures in iOS preventing navigation back


Hi there, how can I prevent in iOS to swipe back to previous page using Nativescript+Angular4?

My Nativescript version is 3.3



Hi @relez

Try this in the constuctor

constructor(private nav: RouterExtensions) {
    this.nav.frame.ios.controller.interactivePopGestureRecognizer.enabled = false;

That way you don’t have to modify the library, but the downside is that you have to re-enable “interactivePopGestureRecognizer” on every page that you want to the back swipe to work on.

source: SO: https://stackoverflow.com/questions/38907953/nativescript-angular-2-disable-swipe-back-on-ios


Hi @multishiv19, this solution did not work on my end, but I was able to do a little search and I found the solution, now my constructor looks like this:

constructor(private page: Page) {
        this.page.enableSwipeBackNavigation = false;

I hope it helps someone in the future.



That sure will help! thanks for sharing it @relez