mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bbf8a87ce7
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44767 Changelog: [Internal] Fixes a lifecycle bug in both the Bridge (`com.facebook.react.bridge`) and Bridgeless (`com.facebook.react.runtime`) integrations of Fusebox in React Native Android, whereby `HostTarget::unregisterInstance` gets called after the `HostTarget` has been destroyed. The solution consists of two parts: 1. If a ReactHost / InstanceManager is asked to destroy itself while it contains no active ReactInstance / ReactContext, we destroy the `HostTarget` immediately. 2. Otherwise, if there *is* a live ReactInstance / ReactContext that has yet to be destroyed, we wait for that to happen before destroying the `HostTarget`. In practice, we do this by checking for the BEFORE_CREATE ( = Host destroyed) lifecycle state every time we destroy a ReactInstance / ReactContext. Reviewed By: javache Differential Revision: D58031215 fbshipit-source-id: 321c73e85afd17a1b38c63f73aee5ebb59c00686