#pragma once #include #include #include #include using namespace facebook::react; namespace reanimated { class ReanimatedCommitHook : public UIManagerCommitHook, public std::enable_shared_from_this { public: ReanimatedCommitHook( const std::shared_ptr &uiManager, const std::shared_ptr &updatesRegistryManager, const std::shared_ptr &layoutAnimationsProxy); ~ReanimatedCommitHook() noexcept override; void commitHookWasRegistered(UIManager const &) noexcept override {} void commitHookWasUnregistered(UIManager const &) noexcept override {} void maybeInitializeLayoutAnimations(SurfaceId surfaceId); RootShadowNode::Unshared shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode #if REACT_NATIVE_MINOR_VERSION >= 80 , const ShadowTreeCommitOptions &commitOptions #endif ) noexcept override; private: std::shared_ptr uiManager_; std::shared_ptr updatesRegistryManager_; std::shared_ptr layoutAnimationsProxy_; SurfaceId currentMaxSurfaceId_ = -1; std::mutex mutex_; // Protects `currentMaxSurfaceId_`. }; } // namespace reanimated