React Native Android, several apps instances running at the same time as result of coming from a background state without have killed the app before
<p>Below is the process to reproduce the error.</p>

<p>Happening in my project v0.29, but i just tested init a new on v0.33 and it's behaving the same way.</p>

<p>When the app is running, press on the home button of the device/simulator and open the app by clicking on the desktop icon, what happens here is that the app restarts mounting the component again without have unmounted it before, resulting in several instances of the app running if you do this many times.</p>

<p><a href="https://i.stack.imgur.com/Xh0Qo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Xh0Qo.png" alt="enter image description here"></a></p>

<p>Then, if you press the device back button it will kill and so unmount the top instance letting you with the previous one until the last is unmounted and it will go to desktop.</p>

<p><a href="https://i.stack.imgur.com/ZAP1N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZAP1N.png" alt="enter image description here"></a></p>

<p>After this if you exit the app as you did initially pressing on the home button and open it by clicking on the desktop icon, this won't restart the app mounting it again, behaving from this moment correctly.
In the same way, if once the app first starts you exit it using the back button, afterwards the home button will behave right.</p>

<p>Also in the same manner, If you implement a package like react-native-activity-android to avoid kill the app when the back button is pressed, you will end up with multiple apps running.</p>

<p><a href="https://i.stack.imgur.com/tdRrx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tdRrx.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/tvVzt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tvVzt.png" alt="enter image description here"></a></p>

<p>I don't know about android, what is happening when the app is killed that after this if you send the app to the background using home button it works properly?</p>

<p>Any ideas how to solve this, so sending the app to the background and reopen it doesn't mount multiples apps?</p>

<p>In case i need to have the app running in the background for location/notification purposes, supposing i can't solve this issue but i can handle events listeners so they aren't executed multiple times. How bad is for performance/memory to have multiples apps mounted at the same time?</p>

<p>Thanks</p>