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
configuration of entering animations is done using nativeID since I was unable to obtain the tag of a view before the animation should start
skipExiting does not work properly on android (I'm not sure why the componentWillUnmount method is called there earlier than on iOS)
globalOriginX and globalOriginY currently return the values of originX and originY - this part will probably require a native convertPoint function to be used
due to view flattening some exiting animations behave differently. The issue is explained in this PR.
Test plan
Go through the Layout Animations examples in the FabricExample app.
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.