#pragma once #include "ErrorHandler.h" #include "LayoutAnimationType.h" #include "Shareables.h" #include #include #include #include #include #include #include #include namespace reanimated { using namespace facebook; class LayoutAnimationsManager { public: void configureAnimation( int tag, LayoutAnimationType type, const std::string &sharedTransitionTag, std::shared_ptr config); bool hasLayoutAnimation(int tag, LayoutAnimationType type); void startLayoutAnimation( jsi::Runtime &rt, int tag, LayoutAnimationType type, const jsi::Object &values); void clearLayoutAnimationConfig(int tag); void cancelLayoutAnimation( jsi::Runtime &rt, int tag, LayoutAnimationType type, bool cancelled /* = true */, bool removeView /* = true */); int findPrecedingViewTagForTransition(int tag); private: std::unordered_map> &getConfigsForType( LayoutAnimationType type); std::unordered_map> enteringAnimations_; std::unordered_map> exitingAnimations_; std::unordered_map> layoutAnimations_; std::unordered_map> sharedTransitionAnimations_; std::unordered_map> sharedTransitionGroups_; std::unordered_map viewTagToSharedTag_; mutable std::mutex animationsMutex_; // Protects `enteringAnimations_`, `exitingAnimations_`, // `layoutAnimations_` and `viewSharedValues_`. }; } // namespace reanimated