RCTView.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #import <UIKit/UIKit.h>
  8. #import <React/RCTBorderStyle.h>
  9. #import <React/RCTComponent.h>
  10. #import <React/RCTPointerEvents.h>
  11. #import <React/RCTView.h>
  12. extern const UIAccessibilityTraits SwitchAccessibilityTrait;
  13. @protocol RCTAutoInsetsProtocol;
  14. @class RCTView;
  15. @interface RCTView : UIView
  16. /**
  17. * Accessibility event handlers
  18. */
  19. @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityAction;
  20. @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap;
  21. @property (nonatomic, copy) RCTDirectEventBlock onMagicTap;
  22. @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityEscape;
  23. /**
  24. * Used to control how touch events are processed.
  25. */
  26. @property (nonatomic, assign) RCTPointerEvents pointerEvents;
  27. + (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
  28. withScrollView:(UIScrollView *)scrollView
  29. updateOffset:(BOOL)updateOffset;
  30. /**
  31. * Find the first view controller whose view, or any subview is the specified view.
  32. */
  33. + (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
  34. /**
  35. * Layout direction of the view.
  36. * This is inherited from UIView+React, but we override it here
  37. * to improve performance and make subclassing/overriding possible/easier.
  38. */
  39. @property (nonatomic, assign) UIUserInterfaceLayoutDirection reactLayoutDirection;
  40. /**
  41. * This is an optimization used to improve performance
  42. * for large scrolling views with many subviews, such as a
  43. * list or table. If set to YES, any clipped subviews will
  44. * be removed from the view hierarchy whenever -updateClippedSubviews
  45. * is called. This would typically be triggered by a scroll event
  46. */
  47. @property (nonatomic, assign) BOOL removeClippedSubviews;
  48. /**
  49. * Hide subviews if they are outside the view bounds.
  50. * This is an optimisation used predominantly with RKScrollViews
  51. * but it is applied recursively to all subviews that have
  52. * removeClippedSubviews set to YES
  53. */
  54. - (void)updateClippedSubviews;
  55. /**
  56. * Border radii.
  57. */
  58. @property (nonatomic, assign) CGFloat borderRadius;
  59. @property (nonatomic, assign) CGFloat borderTopLeftRadius;
  60. @property (nonatomic, assign) CGFloat borderTopRightRadius;
  61. @property (nonatomic, assign) CGFloat borderTopStartRadius;
  62. @property (nonatomic, assign) CGFloat borderTopEndRadius;
  63. @property (nonatomic, assign) CGFloat borderBottomLeftRadius;
  64. @property (nonatomic, assign) CGFloat borderBottomRightRadius;
  65. @property (nonatomic, assign) CGFloat borderBottomStartRadius;
  66. @property (nonatomic, assign) CGFloat borderBottomEndRadius;
  67. /**
  68. * Border colors (actually retained).
  69. */
  70. @property (nonatomic, assign) CGColorRef borderTopColor;
  71. @property (nonatomic, assign) CGColorRef borderRightColor;
  72. @property (nonatomic, assign) CGColorRef borderBottomColor;
  73. @property (nonatomic, assign) CGColorRef borderLeftColor;
  74. @property (nonatomic, assign) CGColorRef borderStartColor;
  75. @property (nonatomic, assign) CGColorRef borderEndColor;
  76. @property (nonatomic, assign) CGColorRef borderColor;
  77. /**
  78. * Border widths.
  79. */
  80. @property (nonatomic, assign) CGFloat borderTopWidth;
  81. @property (nonatomic, assign) CGFloat borderRightWidth;
  82. @property (nonatomic, assign) CGFloat borderBottomWidth;
  83. @property (nonatomic, assign) CGFloat borderLeftWidth;
  84. @property (nonatomic, assign) CGFloat borderStartWidth;
  85. @property (nonatomic, assign) CGFloat borderEndWidth;
  86. @property (nonatomic, assign) CGFloat borderWidth;
  87. /**
  88. * Border styles.
  89. */
  90. @property (nonatomic, assign) RCTBorderStyle borderStyle;
  91. /**
  92. * Insets used when hit testing inside this view.
  93. */
  94. @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
  95. @end