I'm trying to detect when the app gains the focus back (i.e. switch to it from another app) in order to perform a certain task. Is there a way to detect this in React Native?
What I'm doing is copying a file to a temp location, opening it with an external viewer, and then I want to delete the file when the user switches back from the app.
The AppState
module might be what you are looking for. Have a look at the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With