UIManagerDelegate.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <react/core/ReactPrimitives.h>
  9. #include <react/core/ShadowNode.h>
  10. #include <react/mounting/MountingCoordinator.h>
  11. namespace facebook {
  12. namespace react {
  13. /*
  14. * Abstract class for UIManager's delegate.
  15. */
  16. class UIManagerDelegate {
  17. public:
  18. /*
  19. * Called right after a new/updated Shadow Node tree is constructed.
  20. * For this moment the tree is already laid out and sealed.
  21. */
  22. virtual void uiManagerDidFinishTransaction(
  23. MountingCoordinator::Shared const &mountingCoordinator) = 0;
  24. /*
  25. * Called each time when UIManager constructs a new Shadow Node. Receiver
  26. * might use this to optimistically allocate a new native view
  27. * instances.
  28. */
  29. virtual void uiManagerDidCreateShadowNode(
  30. const ShadowNode::Shared &shadowNode) = 0;
  31. /*
  32. * Called when UIManager wants to dispatch a command to the mounting layer.
  33. */
  34. virtual void uiManagerDidDispatchCommand(
  35. const ShadowNode::Shared &shadowNode,
  36. std::string const &commandName,
  37. folly::dynamic const args) = 0;
  38. /*
  39. * Set JS responder for a view
  40. */
  41. virtual void uiManagerDidSetJSResponder(
  42. SurfaceId surfaceId,
  43. ShadowNode::Shared const &shadowView,
  44. bool blockNativeResponder) = 0;
  45. /*
  46. * Clear the JSResponder for a view
  47. */
  48. virtual void uiManagerDidClearJSResponder() = 0;
  49. virtual ~UIManagerDelegate() noexcept = default;
  50. };
  51. } // namespace react
  52. } // namespace facebook