3

Can I add some handle after user press Home button in android ?

Such as show modal ask user need to exit app or cancel.

I see this link Detect home button press in android can helpful.

But I do not know how to apply that code to MainActivity.java of android in react-native.

onUserLeaveHint is work after app close but I need modal work before app close.

Thank for any help.

1 Answers1

0

I was able to solve it myself. I open sourced my solution here - https://www.npmjs.com/package/react-native-home-pressed Let me know what you think

evanjmg
  • 3,465
  • 1
  • 14
  • 12