Add Animation Backend integration#8875
Draft
coado wants to merge 74 commits intosoftware-mansion:mainfrom
Draft
Conversation
…r animation backend
This file contains hidden or 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
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 diff adds
reanimatedintegration with thereact-nativeanimation backend. It enables CSS animations and transitions to emit mutations usingAnimatedPropsstructure, allowing the animation backend to receive the expected style directly and avoiding parsing thefolly::dynamicobject. For that, interpolator factories were extended to accept a method that handles packing and adding progressedCSSValuefor particular prop usingAnimatedPropsBuilder. Updates from props builder are then added to the newupdatesBatchAnimatedProps. Only props from theVIEW_INTERPOLATORSare supported by the animation backend.The
AnimatedPropsBuilderis created inCSSTransitionRegistryorCSSAnimationRegistryand passed throughCSSAnimationsandCSSTransitionsupdate methods down to the particular interpolators from which the packing callbacks are invoked.The new feature flag
USE_ANIMATION_BACKENDis introduced to gate the animation backend connection and collecting updates inupdatesBatchAnimatedProps.The
backwardsFillModedoes not work properly because the initial props styles are not collected in theReanimatedCommitHook::shadowTreeWillCommit.On Android when the props reconciliation is disabled it is required to pass
non-layoutprops usingrawPropsas afolly::dynamicobject. When it's enabled, updates can be distributed usingAnimatedPropsformat.There are three updates batches used in
performOperationsForBackend:cssUpdatesBatch- used on Android when the props reconciliation is disabled to collect updates fornon-layoutprops,animatedUpdatesBatch- stores updates from AnimatedPropsRegistry,animatedPropsUpdatesBatch- stores updates inAnimatesPropsfor all props on IOS. On Android for layout props when the props reconciliation is disabled and when enabled, stores all props as well.Interpolators will not add updates to the
AnimatedPropsBuilderfor thenon-layoutprops when the props reconciliation is disabled on Android. This leaves place for thenon-layoutupdates collected in thecssUpdatesBatch.Test plan
Tested on reanimated example app