Legacy APIs
If you have some previous ComponentKit experience you probably encountered other animation-related APIs in CK such as animationsOnInitialMount
or animationsOnFinalUnmount
. Currently, we are slowly transitioning away from those APIs since they encourage creating more subclasses (which is bad for the binary size) and at the same time limit component reusability.
Indeed, if you use one of those methods, your component will always have the same initial or final animation regardless of context it's being used in. While this may be the behaviour you are looking for, usually there are better ways to achieve the same effect, such as described in the section "Initial / Final Animations" above. In general, you should turn to wrapping animated components in CKAnimationComponent
first, before using animationsOnInitialMount
or animationsOnFinalUnmount
. If you actually need to have the same animations for the same component in multiple places, you should consider factoring wrapping this component in CKAnimationComponent
to a separate function and using this function instead.
Another API that is somewhat discouraged to use is providing the CKComponentAnimationHooks
directly. There are some use cases that do require using that API, usually, integrations with other animation systems like POP or UIKit animations, and until fairly recently, final animation was one of such use cases too. Animation hooks should almost never be your first choice when animating your components, and we are working on reducing the number of cases when they are still needed by bringing the relevant functionality inside the framework.