Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up animation on back button press + animated reattach on tab sw…
…itch (#46438) Summary: Pull Request resolved: #46438 When hiding a view with React.Activity, React will "detach" all the views in teh subtree (call all their effect cleanups) and then upon showing it again will attach them (call all their effects again). This was previously causing problems with useAnimatedProps and #46205 was intended to fix it (cc javache), but it's still a perf drain to have to detach all of this and then re-attach it upon show. Worse, it makes it so that we can't actually do any animations upon re-showing a view until all the passive effects have run to re-attach the views to the animations. So instead, what this diff does is lean on the fact that useInsertionEffect *does not* clean up and rerun when Activity goes from hidden to visible and vice versa. Thus, we can rely on it to only detach the animated node when we're *actually* unmounting - rather than when we're simply hiding/showing. Changelog: [General][Changed] - Improved the performance of unmounting (and updating, when an enclosing Activity becomes hidden) Animated components Reviewed By: yungsters, sammy-SC Differential Revision: D62398039 fbshipit-source-id: af286e428188b5104f6cfd3fd4d8c9f791dedb8d
- Loading branch information