Support Android Transitions during Fragment navigation
Summary:
Adds support for Android Transitions during Fragment navigation.
React Native navigation libraries (like the Navigation router and React Native Screens) use Fragments to manage the stack of screens. But they can’t use Transitions to animate these Fragments because React Native images disappear during the Transition (see the videos in the Test Plan section below).
Navigation libraries are forced to setCustomAnimations instead of enter and exit Transitions. But animations have limitations compared to Transitions
- Animations have to be resx files so can’t be defined declaratively in React
- Android’s Material Transforms are built around Transitions
- Native shared elements only support Transitions
Images disappearing during Transitions is a known Fresco bug. This PR applies the fix suggested by the Fresco repo.
Changelog:
[ANDROID] [FIXED] - Support Android Transitions during Fragment navigation
Test Plan:
I’ve created a minimal reproduction that demonstrates the bug. The first video below shows the example from that repo. You can see that the image disappears when changing the painting. It should fade out and in like the text does.
The second video shows the same example after the fix is applied. You can see that the painting fades out and in just like the text.
https://github.com/facebook/react-native/assets/1761227/6739f029-eda0-44d2-b328-a73b075bd82a
https://github.com/facebook/react-native/assets/1761227/9c73cdf0-303b-4a82-8df5-5f6a5846a58e
@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
Thanks for your help @javache
@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This pull request was successfully merged by @grahammendick in 187f16ddc66493c3046ceffed69e21c646dfa7b1.
When will my fix make it into a release? | Upcoming Releases