Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28460

React native hardware back button is not working

$
0
0

I'm working on react native Android and face problem for hardware back button my react native version is 0.44.2 and I'm using BackHandler below is my code for the back button:

BackHandler.addEventListener("hardwareBackPress", () => {
  if (this.navigator && this.navigator.getCurrentRoutes().length > 1){this.navigator.pop()
return true // do not exit app
} else {
return false // exit app
}})

I got the following error:

Error_for_back_button


Viewing all articles
Browse latest Browse all 28460

Trending Articles