fix(android): only attach if activity is CREATED (#9552)

This commit is contained in:
Eduardo Speroni
2021-09-18 17:27:21 -03:00
committed by GitHub
parent 76dacb30ee
commit 90b8718138

View File

@ -144,8 +144,8 @@ export class Frame extends FrameBase {
// _onAttachedToWindow called from OS again after it was detach
// still happens with androidx.fragment:1.3.2
const activity = androidApplication.foregroundActivity || androidApplication.startActivity;
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
const lifecycleState = (androidApplication.foregroundActivity?.getLifecycle?.() || androidApplication.startActivity?.getLifecycle?.())?.getCurrentState() || androidx.lifecycle.Lifecycle.State.CREATED;
if ((this._manager && this._manager.isDestroyed()) || !lifecycleState.isAtLeast(androidx.lifecycle.Lifecycle.State.CREATED)) {
return;
}