question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to prevent default (back navigation) on hardware back button?

See original GitHub issue

Hi I’m able to subscribe to the backButton event via Plugins.App.addListener('backButton', function() {...}); but I can’t seem to prevent the navigation from going backwards to the previous page. Any help would be appreciated. Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

7reactions
speyoucommented, Jun 17, 2019

What about not Ionic users then?

3reactions
Sampath-Lokugecommented, Oct 26, 2020

@speyou This works for me,

  App.addListener('backButton', () => {
   });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to preventDefault and override browser's back button ...
Short answer: You can't change it. Long answer: You should first set a State then get it with event handler. So, simply, when...
Read more >
Preventing going back - React Navigation
You can achieve it by using the beforeRemove event. The event listener receives the action that triggered it.
Read more >
How to stop browser back button using JavaScript
In this article, we will discuss how to write a javascript function which will prevent the user to navigate back to the last...
Read more >
Handling Android Back Button Press in React Native
When the user presses the Android hardware back button in React Native, react-navigation will pop a screen or exit the app if there...
Read more >
Disabling back button in React with react-router v5 - Ye Joo Park
We want to prevent the back navigation altogether. But as easy as it sounds, there is no way to disable a back button...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found