Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions packages/react-native/React/Base/RCTUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *
return [view hitTest:point withEvent:event];
}

UIKIT_STATIC_INLINE BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
{
return view.clipsToBounds;
}

UIKIT_STATIC_INLINE void RCTUIViewSetContentModeRedraw(UIView *view)
{
view.contentMode = UIViewContentModeRedraw;
Expand Down Expand Up @@ -398,8 +393,6 @@ void UIBezierPathAppendPath(UIBezierPath *path, UIBezierPath *appendPath);

- (void)setNeedsDisplay;

// FUTURE: When Xcode 14 is no longer supported (CI is building with Xcode 15), we can remove this override since it's now declared on NSView
@property BOOL clipsToBounds;
@property (nonatomic, copy) NSColor *backgroundColor;
@property (nonatomic) CGAffineTransform transform;

Expand Down Expand Up @@ -462,8 +455,6 @@ NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPo
return [view hitTest:pointInSuperview];
}

BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view);

NS_INLINE void RCTUIViewSetContentModeRedraw(RCTPlatformView *view)
{
view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize;
Expand Down Expand Up @@ -604,8 +595,6 @@ typedef UIImageView RCTUIImageView;
#else
@interface RCTUIImageView : NSImageView
NS_ASSUME_NONNULL_BEGIN
// FUTURE: When Xcode 14 is no longer supported (CI is building with Xcode 15), we can remove this override since it's now declared on NSView
@property (assign) BOOL clipsToBounds;
@property (nonatomic, strong) RCTUIColor *tintColor;
@property (nonatomic, assign) UIViewContentMode contentMode;
NS_ASSUME_NONNULL_END
Expand Down
24 changes: 0 additions & 24 deletions packages/react-native/React/Base/macOS/RCTUIKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -526,20 +526,6 @@ - (void)setAlwaysBounceVertical:(BOOL)alwaysBounceVertical

@end

BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
{
// NSViews are always clipped to bounds
BOOL clipsToBounds = YES;

// But see if UIView overrides that behavior
if ([view respondsToSelector:@selector(clipsToBounds)])
{
clipsToBounds = [(id)view clipsToBounds];
}

return clipsToBounds;
}

@implementation RCTClipView

- (instancetype)initWithFrame:(NSRect)frameRect
Expand Down Expand Up @@ -743,16 +729,6 @@ - (instancetype)initWithFrame:(CGRect)frame
return self;
}

- (BOOL)clipsToBounds
{
return [[self layer] masksToBounds];
}

- (void)setClipsToBounds:(BOOL)clipsToBounds
{
[[self layer] setMasksToBounds:clipsToBounds];
}

- (void)setContentMode:(UIViewContentMode)contentMode
{
_contentMode = contentMode;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ - (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:
// we do support clipsToBounds, so if that's enabled
// we'll update the clipping

if (RCTUIViewSetClipsToBounds(self) && self.subviews.count > 0) { // [macOS]
if (self.clipsToBounds && self.subviews.count > 0) {
clipRect = [clipView convertRect:clipRect toView:self];
clipRect = CGRectIntersection(clipRect, self.bounds);
clipView = self;
Expand All @@ -77,7 +77,7 @@ - (RCTPlatformView *)react_findClipView // [macOS]
CGRect clipRect = self.bounds;
// We will only look for a clipping view up the view hierarchy until we hit the root view.
while (testView) {
if (RCTUIViewSetClipsToBounds(testView)) { // [macOS]
if (testView.clipsToBounds) {
if (clipView) {
CGRect testRect = [clipView convertRect:clipRect toView:testView];
if (!CGRectContainsRect(testView.bounds, testRect)) {
Expand Down
Loading