ViewProps.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/components/view/AccessibilityProps.h>
  9. #include <react/components/view/YogaStylableProps.h>
  10. #include <react/components/view/primitives.h>
  11. #include <react/core/LayoutMetrics.h>
  12. #include <react/core/Props.h>
  13. #include <react/graphics/Color.h>
  14. #include <react/graphics/Geometry.h>
  15. #include <react/graphics/Transform.h>
  16. namespace facebook {
  17. namespace react {
  18. class ViewProps;
  19. using SharedViewProps = std::shared_ptr<ViewProps const>;
  20. class ViewProps : public YogaStylableProps, public AccessibilityProps {
  21. public:
  22. ViewProps() = default;
  23. ViewProps(ViewProps const &sourceProps, RawProps const &rawProps);
  24. #pragma mark - Props
  25. // Color
  26. Float opacity{1.0};
  27. SharedColor foregroundColor{};
  28. SharedColor backgroundColor{};
  29. // Borders
  30. CascadedBorderRadii borderRadii{};
  31. CascadedBorderColors borderColors{};
  32. CascadedBorderStyles borderStyles{};
  33. // Shadow
  34. SharedColor shadowColor{};
  35. Size shadowOffset{};
  36. Float shadowOpacity{};
  37. Float shadowRadius{};
  38. // Transform
  39. Transform transform{};
  40. BackfaceVisibility backfaceVisibility{};
  41. bool shouldRasterize{};
  42. int zIndex{};
  43. // Events
  44. PointerEventsMode pointerEvents{};
  45. EdgeInsets hitSlop{};
  46. bool onLayout{};
  47. bool collapsable{true};
  48. #pragma mark - Convenience Methods
  49. BorderMetrics resolveBorderMetrics(LayoutMetrics const &layoutMetrics) const;
  50. bool getClipsContentToBounds() const;
  51. #ifdef ANDROID
  52. bool getProbablyMoreHorizontalThanVertical_DEPRECATED() const;
  53. #endif
  54. #pragma mark - DebugStringConvertible
  55. #if RN_DEBUG_STRING_CONVERTIBLE
  56. SharedDebugStringConvertibleList getDebugProps() const override;
  57. #endif
  58. };
  59. } // namespace react
  60. } // namespace facebook