react-native-threads
react-native-threads copied to clipboard
Threads getting killed on back-button press
Hi, Im using this thread lib on the react facebook example app. When I press the back button from the main screen of my app the app goes to background (terminates kind-of). Thats the default behavior as far as i know.
The problem is, when this happens, the onHostDestroy method gets called. So the threads are terminated.
When I re-enter the app, nothing gets created, as the app is in a intermediate state, so the threads arent re-created. Instead a onHostResume gets called.
For now i have fixed this by changing the onHostDestroy method just to call onHostPause. But i dont know if this is a good long term solution.
Oneplus 6 Android 8.1.0
Interesting! I probably haven't run into this bug yet because my app is pro-active about restarting threads that become unresponsive (my threads echo back every message they receive, and if they stop echoing for a long enough period of time I destroy and re-create them)
I'm also not sure if delegating an onHostDestroy call to an onHostPause method is the best long term solution. 🤔 Definitely open to hearing potential solutions for this