fix(android): FragmentCallbacksImplementation memory leak (#9977)

This commit is contained in:
Douglas Machado
2022-07-27 15:15:51 -03:00
committed by GitHub
parent 59f923528d
commit 286d36b03b

View File

@@ -1031,9 +1031,14 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
// animation should start between start and resume, so if we have an executing navigation here it probably means the animation was skipped
// so we manually set the entry
// also, to be compatible with fragments 1.2.x we need this setTimeout as animations haven't run on onResume yet
const weakRef = new WeakRef(this);
setTimeout(() => {
if (frame._executingContext && !(<any>this.entry).isAnimationRunning) {
frame.setCurrent(this.entry, frame._executingContext.navigationType);
const owner = weakRef.get();
if (!owner) {
return;
}
if (frame._executingContext && !(<any>owner.entry).isAnimationRunning) {
frame.setCurrent(owner.entry, frame._executingContext.navigationType);
}
}, 0);