StubView.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <vector>
  10. #include <react/core/LayoutMetrics.h>
  11. #include <react/core/State.h>
  12. #include <react/debug/debugStringConvertibleUtils.h>
  13. #include <react/mounting/ShadowView.h>
  14. namespace facebook {
  15. namespace react {
  16. class StubView final {
  17. public:
  18. using Shared = std::shared_ptr<StubView>;
  19. StubView() = default;
  20. StubView(StubView const &stubView) = default;
  21. void update(ShadowView const &shadowView);
  22. ComponentName componentName;
  23. ComponentHandle componentHandle;
  24. Tag tag;
  25. SharedProps props;
  26. SharedEventEmitter eventEmitter;
  27. LayoutMetrics layoutMetrics;
  28. State::Shared state;
  29. std::vector<StubView::Shared> children;
  30. };
  31. bool operator==(StubView const &lhs, StubView const &rhs);
  32. bool operator!=(StubView const &lhs, StubView const &rhs);
  33. #if RN_DEBUG_STRING_CONVERTIBLE
  34. std::string getDebugName(StubView const &stubView);
  35. std::vector<DebugStringConvertibleObject> getDebugProps(
  36. StubView const &stubView,
  37. DebugStringConvertibleOptions options);
  38. std::vector<StubView> getDebugChildren(
  39. StubView const &stubView,
  40. DebugStringConvertibleOptions options);
  41. #endif
  42. } // namespace react
  43. } // namespace facebook