Is there a way to detect when a react-native application will terminate?
I was thinking of componentWillUnmount
at the main component level, do you think that's best way to do it?
I would like to send a "Save" request to the server before. I'm not sure if that's appropriate while the application in terminating, any better suggestion?
Thanks
According to https://github.com/facebook/react-native/issues/9348, it is not possible to do any cleanup on the JS side, you need to do it natively with applicationWillTerminate (which also means sync stuff between js and native code). I have an issue with my app terminating while running in the background, and I'm really looking forward to finding an explanation on how to do that.
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