-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Layout Animations for the New Architecture #6055
Merged
bartlomiejbloniarz
merged 85 commits into
main
from
@bartlomiejbloniarz/fabric-layout-animations
Jun 18, 2024
Merged
Layout Animations for the New Architecture #6055
bartlomiejbloniarz
merged 85 commits into
main
from
@bartlomiejbloniarz/fabric-layout-animations
Jun 18, 2024
Conversation
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
facebook-github-bot
pushed a commit
to facebook/react-native
that referenced
this pull request
Jun 14, 2024
Summary: PR changing the single mountingOverrideDelegate to a vector of those, so other listeners can operate on the transaction. Used by `react-native-screens` in software-mansion/react-native-screens#2134 and `react-native-reanimated` in software-mansion/react-native-reanimated#6055. Till now, only one listener could be added there, meaning that e.g. `Layout Animations` from `react-native`, `Layout Animations` from `react-native-reanimated` and listening for `Screen` removal in `react-native-screens` could not operate at the same time. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [GENERAL] [FIXED] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [FIXED] - Add option for multiple `mountingOverrideDelegates` Pull Request resolved: #44927 Test Plan: The code of `LayoutAnimations` inside `react-native` should work the same since it will add just one listener then. For other cases, different libraries can read/mutate transactions. Reviewed By: javache Differential Revision: D58530278 Pulled By: sammy-SC fbshipit-source-id: d6305963621000be11d51a50cffff64526cca934
piaskowyk
approved these changes
Jun 17, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👏👏👏
For me, this is ready to merge. Let users test it in real-life scenarios, and we can gather feedback accordingly.
bartlomiejbloniarz
deleted the
@bartlomiejbloniarz/fabric-layout-animations
branch
June 18, 2024 08:38
Nice work guys 👏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR brings layout animations to the New Architecture.
In the Old Architecture layout animations were implemented separately for iOS and Android. The new implementation leverages the
MountingOverrideDelegate
to intercept and animate layout changes right before they are sent to the platform. This way we can have a unified implementation across platforms (it should also work beyond Android and iOS).MountingOverrideDelegate
The override delegate is called every time a new transaction is about to be mounted. It gives us full access to the mutations list and allows us to change them. This mechanism is used by RN, also in Layout Animations. It is important to note that this way we never commit a new
ShadowTree
- we only change the mutations that are sent to the platform. This means that those changes don't influence the layout of other views, which is consistent with the Old Arch implementation.Limitations
nativeID
since I was unable to obtain thetag
of a view before the animation should startskipExiting
does not work properly on android (I'm not sure why thecomponentWillUnmount
method is called there earlier than on iOS)globalOriginX
andglobalOriginY
currently return the values oforiginX
andoriginY
- this part will probably require a nativeconvertPoint
function to be usedTest plan
Go through the Layout Animations examples in the FabricExample app.