Enable Swipe to go back in Ionic 4?

For Ionic 4 I can’t find anything about how to enable Swipe to go back like Ionic 3 has on by default. I’ve found a github issue where it’s said it is now in Ionic 4. But there is nothing the docs.

Also, the page transition by default is like modal from bottom up. Is there any information out there how to change these default behaviors now that Ionic 4 is fully released?

1 Like

Isn’t called swipeGesture?

See https://github.com/ionic-team/ionic/blob/b31b9f45de1496432561a583843e6166f9aa53f5/core/src/components/nav/readme.md -> swipeGesture

1 Like

Thx. For anyone else wanting to enable you enable it like this:
<ion-router-outlet main [swipeGesture]=“true”></ion-router-outlet>

But since the default Ionic 4 animation for page transitions is a “modal” like animation from bottom up with a fade in / out it’s reeeally ugly. =P

3 Likes

That’s the md (“Android”) animation, switch or debug an iOS device you will have an iOS animation

Do you happen to know where I can set this? The docs on says there is an Animation property, but I’m not sure where to set this. I’m trying to dig through the NavController but I just can’t find how to change this setting.

No idea. I mean Android users except Android look & feel, same for iOS users. You could create another post if you want t

You can force a specific animation in the app.module.ts file:

IonicModule.forRoot({
navAnimation: AnimationBuilder <{}>,
swipeBackEnabled: true // A better spot to set swipe enabled also…
}),

But I have no clue how to use the @ionic/core transitions here:

Anyone know how to do this?

1 Like

i use Ionic:

ionic (Ionic CLI) : 4.12.0 (/Users/shally/.nvm/versions/node/v8.16.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

i set

IonicModule.forRoot({
swipeBackEnabled: true // A better spot to set swipe enabled also…
}),

but,it’s not working in ios

Today ,i init a new project
Ionic:

Ionic CLI : 5.2.7 (/Users/shally/.nvm/versions/node/v10.15.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.9.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 7.1.0
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 4 other plugins)

Utility:

cordova-res : not installed
native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (/Users/shally/Library/Android/sdk/)
ios-deploy : 1.9.4
ios-sim : 8.0.0
NodeJS : v10.15.3 (/Users/shally/.nvm/versions/node/v10.15.3/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8

but it’s not untill working! i don’t know why ,anyone help me;thx!

Even if the thread is quite old I stumbled upon it today, too.
I realized that Ionic has the following exposed:

import { createGesture } from '@ionic/core';

Where you can build your own swipe to go back gesture with guards and whatnots.
Cheers

1 Like