forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unmount React applications when re-creating context [RFC] (facebook#3…
…7004) Summary: Pull Request resolved: facebook#37004 Currently in RN Android when re-creating the context we don't unmount the underlying React application. This violates ViewManager and React hooks contracts, who are no longer able to properly unmount views, and instead the view hierarchy is forcefully torn down by Android UI. This differs from iOS, where we do unmount the application on reloads. This is a trade-off with performance, as we'll keep the JS thread alive slightly longer to complete shutdown, but it's the right call for correctness. It also only mainly affects development, as recreating the context is rare in production. Repro steps: ``` useEffect(() => { console.log('Playground useEffect invoked'); return () => { console.log('Playground useEffect destructor invoked'); }; }, []); ``` Validate that when reloading the application, the second console.log is printed. Changelog: [Android][Changed] React trees will be unmounted when the application is reloaded Differential Revision: D45145520 fbshipit-source-id: 1034c9201908d18a402adc6ee05fae0c2f3cd6d0
- Loading branch information
1 parent
57c3692
commit 5c5a822
Showing
4 changed files
with
71 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
...eact-native/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/ReactFabric.java
This file was deleted.
Oops, something went wrong.