software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.87k stars 1.3k forks source link

Layout Animations for the New Architecture #6055

Closed bartlomiejbloniarz closed 3 months ago

bartlomiejbloniarz commented 4 months ago

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

Test plan

Go through the Layout Animations examples in the FabricExample app.

tjzel commented 3 months ago

Please add some machine learning here 🙏

mrousavy commented 3 months ago

impressive stuff!! 💪

mrousavy commented 3 months ago

Nice work guys 👏