ViewEventEmitter.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <memory>
  9. #include <mutex>
  10. #include <react/core/LayoutMetrics.h>
  11. #include <react/core/ReactPrimitives.h>
  12. #include "TouchEventEmitter.h"
  13. namespace facebook {
  14. namespace react {
  15. class ViewEventEmitter;
  16. using SharedViewEventEmitter = std::shared_ptr<const ViewEventEmitter>;
  17. class ViewEventEmitter : public TouchEventEmitter {
  18. public:
  19. using TouchEventEmitter::TouchEventEmitter;
  20. #pragma mark - Accessibility
  21. void onAccessibilityAction(const std::string &name) const;
  22. void onAccessibilityTap() const;
  23. void onAccessibilityMagicTap() const;
  24. void onAccessibilityEscape() const;
  25. #pragma mark - Layout
  26. void onLayout(const LayoutMetrics &layoutMetrics) const;
  27. private:
  28. mutable std::mutex layoutMetricsMutex_;
  29. mutable LayoutMetrics lastLayoutMetrics_;
  30. };
  31. } // namespace react
  32. } // namespace facebook