bug: hardwareBackButton config option not working as expected
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior: ‘hardwareBackButton’ option described here is not working.
Expected behavior: Android hardware back button must be disabled.
Related code:
@NgModule({
declarations: [
AppComponent,
],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot({
hardwareBackButton: false,
}),
AppRoutingModule,
],
providers: [
SplashScreen,
StatusBar,
{provide: RouteReuseStrategy, useClass: IonicRouteStrategy},
],
bootstrap: [AppComponent],
})
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.12.0 (/Users/ramon.carreras/.nvm/versions/node/v8.15.1/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.4.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
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 6 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/ramon.carreras/Library/Android/sdk)
ios-deploy : 2.0.0
NodeJS : v8.15.1 (/Users/ramon.carreras/.nvm/versions/node/v8.15.1/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:19 (3 by maintainers)
Top Results From Across the Web
bug: hardwareBackButton config option not working ... - GitHub
Current behavior: 'hardwareBackButton' option described here is not working. Expected behavior: Android hardware back button must be disabled.
Read more >My Hardware 'Back Button Action' is not working in Ionic 4
Try This: lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList < IonRouterOutlet > ; backButtonEvent() ...
Read more >Hardware back button with Ionic 4 Disable
Hi everyone, How do I disable the hardware back button in android? ... Issue: bug: hardwareBackButton option in Config is not working.
Read more >How To Fix Back Button Not Working on iPhone and Android
Restart the Device. Even Android phones with a hardware back button didn't always withstand the worst software bugs. The good news is that...
Read more >Troubleshooting | React Navigation
Missing extensions in metro configuration. Sometimes the error may look like this: Error: While trying to resolve module "@react-navigation/native ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you try the following dev build and let me know if it resolves the issue?
Angular
React
Vue
Stencil/Vanilla JavaScript
@fernandomeridamatilla @rrath-edr @fer-fullstackdev
An actual workaround that seems to work for me on @ionic/angular 4.6.2 is :
document.addEventListener("backbutton",function(e) { console.log("disabled") }, false);
Code taken from cordova docs : here
Seems to work on any page other than my initial first page.