/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include #include #include #include #include #include #include "AnimatedProps.h" #include "AnimatedPropsBuilder.h" namespace facebook::react { struct AnimationMutation { Tag tag; const ShadowNodeFamily *family; AnimatedProps props; }; using AnimationMutations = std::vector; class AnimationBackend : public UIManagerAnimationBackend { public: using Callback = std::function; using StartOnRenderCallback = std::function &&, bool /* isAsync */)>; using StopOnRenderCallback = std::function; using DirectManipulationCallback = std::function; using FabricCommitCallback = std::function &)>; std::vector callbacks; const StartOnRenderCallback startOnRenderCallback_; const StopOnRenderCallback stopOnRenderCallback_; const DirectManipulationCallback directManipulationCallback_; const FabricCommitCallback fabricCommitCallback_; UIManager *uiManager_; AnimationBackend( StartOnRenderCallback &&startOnRenderCallback, StopOnRenderCallback &&stopOnRenderCallback, DirectManipulationCallback &&directManipulationCallback, FabricCommitCallback &&fabricCommitCallback, UIManager *uiManager); void commitUpdatesWithFamilies( const std::unordered_set &families, std::unordered_map &updates); void synchronouslyUpdateProps(const std::unordered_map &updates); void onAnimationFrame(double timestamp) override; void start(const Callback &callback, bool isAsync); void stop(bool isAsync) override; }; } // namespace facebook::react