Skip to content

Commit 2428d74

Browse files
Nick LefeverSaadnajmi
authored andcommitted
[fabric] Add support for clipsToBounds to RCTViewComponentView
Summary: This diff conditionally sets the CALayer masksToBounds based on the clipsToBounds RN property so that the content of the view would be clipped by the view border. Test Plan: - Run Zeratul with Fabric enabled - Check that the profile pictures with no status indicator are clipped by the half size border radius set on the parent view. | Before | After | |--| | {F1090251649} | {F1090249259} | Reviewers: shawndempsey, chpurrer, #rn-desktop Reviewed By: chpurrer Differential Revision: https://phabricator.intern.facebook.com/D49239973
1 parent e5426cc commit 2428d74

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,11 @@ - (void)invalidateLayer
862862
return;
863863
}
864864

865+
#if TARGET_OS_OSX // [macOS
866+
// clipsToBounds is stubbed out on macOS because it's not part of NSView
867+
layer.masksToBounds = self.clipsToBounds;
868+
#endif // macOS]
869+
865870
const auto borderMetrics = _props->resolveBorderMetrics(_layoutMetrics);
866871

867872
// Stage 1. Shadow Path

0 commit comments

Comments
 (0)