Ionic version: 3.10.3
I'm submitting a ... Bug
Current behavior:
I can not get swipe to go back to previous page using the start tabs project in Ionic. Here is what I have:
I am using navCtrl.push() to navigate between pages.
I am testing on Android 6.0.1
Yet the swipe to go back feature does not work after pushing onto the navigation stack:
this.navCtrl.push(DetailPage, PageData);
Ionic info:
@ionic/cli-plugin-proxy : 1.4.9
@ionic/cli-utils : 1.10.2
ionic (Ionic CLI) : 3.10.3
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.0.2
Cordova Platforms : android 6.2.3 browser 5.0.0
Ionic Framework : ionic-angular 3.5.3
System:
Android SDK Tools : 26.0.2
Node : v6.11.2
npm : 3.10.10
OS : Windows 10
Hello! Thank you for opening an issue with us! Would you be able to provide a sample application via GitHub that demonstrates the issue you are having? Thanks for using Ionic!
Hi! I have created a sample project to demonstrates the issue.
find the project at https://github.com/gurwinder-macrew/sampleProject
To reproduce,
Start application and click on "Details" button. And then try swipe back to get back on Home page.
I am testing on my android device (Android 6.0.1).
Thank you for the sample application. I was able to get this to work on Android by setting the option globally in the app.module.ts file as such:
imports: [
BrowserModule,
IonicModule.forRoot(MyApp, { swipeBackEnabled: true })
],
I believe this is because this is a tab application, so the NavController you are setting this on is not actually the NavController in effect at the time.
Thanks you for your solution. Its working for me. But i have one more case. I am opening page in Model and unable to go back to previous page using swipe. I have also updated the sample app to reproduce same.
How to reproduce:
Download the GitHub code.
Open app and click on "Info Model" button
Try swipe back.
Sample App
https://github.com/gurwinder-macrew/sampleProject
Also,
I don't want to show Tabs in "Info Page" screen, so I am opening In "Info page" in model. Do you have any alternative for this?
Sorry, lost track of this in the shuffle.
Modal won't work because the "swipe to go back" is a nav thing, and opening a modal is not a navigation. It is more akin to opening an action sheet or popup.
On a device larger than a phone, swiping back to close the modal would be an odd action anyhow, and you would probably want to just keep enableBackdropDismiss: true to make it easy to get rid of the dialog. On a phone that is obviously irrelevant.
For this:
I don't want to show Tabs in "Info Page" screen, so I am opening In "Info page" in model. Do you have any alternative for this?
I urge that you ask this question on our forum or on our slack channel.
Thanks for using Ionic!
@kensodemann
I have the same problem . I already set
imports: [
BrowserModule,
IonicModule.forRoot(MyApp, { swipeBackEnabled: true })
],
but no work . My ionic version is 3.13.2. Do you any opinion for this ?
Strange.. in my case I want to disable it and I can麓t get it haha
In browser and on Android works fine, but in iOS (simulator or device) I cannot disable the swipe back.
Anyone tried something different?
ionic info:
cli packages: (/Projetos/appcultura/src/node_modules)
@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.4.0 ios 4.4.0
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.1
ios-sim : 4.1.1
Node : v7.8.0
npm : 5.5.1
OS : macOS Sierra
Xcode : Xcode 9.0.1 Build version 9A1004
I finally solved the problem, my mistake! I noticed that in my config.xml had:
<preference name="AllowBackForwardNavigationGestures" value="true" />
I just deleted it and everything worked perfectly!!
Thanks.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Thank you for the sample application. I was able to get this to work on Android by setting the option globally in the
app.module.tsfile as such:I believe this is because this is a tab application, so the NavController you are setting this on is not actually the NavController in effect at the time.