Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android Transitions during Fragment navigation #37857

Closed

Conversation

grahammendick
Copy link
Contributor

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.

Screen.Recording.2023-06-12.at.22.41.07.mov
Screen.Recording.2023-06-12.at.22.39.48.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 13, 2023
@facebook-github-bot
Copy link
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@grahammendick grahammendick requested a review from javache June 19, 2023 11:34
@grahammendick
Copy link
Contributor Author

grahammendick commented Jun 19, 2023

Thanks for your help @javache

@facebook-github-bot
Copy link
Contributor

@dmytrorykun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@github-actions
Copy link

This pull request was successfully merged by @grahammendick in 187f16d.

When will my fix make it into a release? | Upcoming Releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants