Detect application termination using

Is there a way to detect when a reaction-based application will stop?

I was thinking about componentWillUnmount at the core component level, do you think this is the best way to do this?

I would like to send a Save request to the server earlier. I'm not sure if this is suitable when the application is terminated, is there any better suggestion?

thanks

+5
source share
2 answers

Perhaps you will send an event when the native applicationWillTerminate method is called, and then send a request from the JS code after receiving such an event.

0
source

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 this initially with applicationWillTerminate (which also means synchronization between js and native code). I have a problem with terminating my application while running in the background, and I really hope to find an explanation of how to do this.

0
source

All Articles