Fabric: Stopping messing with `clipToBounds` in RCTViewComponentView
Summary: There was a reason why it exists: on iOS if you want to implement a view with rounded corners with a non-transparent background you need to set `clipToBounds = YES` to enabling clipping because besides drawing borders we need to clip the background otherwise it will "stick out". There were a bunch of problems with this implementation and approach: * It's overshooting. It applies `clipToBounds` no matter which border-radius is and no matter is there a background or not. So, it's kinda heuristic implementation and it's totally unexpected behavior sometimes. * The previous problems can lead to performance problems as well (clipping requires additional work to do for CoreGraphics/GPU). * The border-radius that we assigned to contentView is incorrect because it does not take border-width into account. * This functionality only applies to non-null `contentView` which is a rear and custom case in which that can always be done manually for components that require that for some reason. Reviewed By: mdvacca Differential Revision: D15397282 fbshipit-source-id: 1599882ca8e591a9c4edb4d2b845bbf3d147bfce
This commit is contained in:
Родитель
b0d1f9ac10
Коммит
a982decb84
|
@ -412,8 +412,6 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
|||
CGColorRelease(borderColor);
|
||||
layer.cornerRadius = (CGFloat)borderMetrics.borderRadii.topLeft;
|
||||
layer.backgroundColor = _backgroundColor.CGColor;
|
||||
_contentView.layer.cornerRadius = (CGFloat)borderMetrics.borderRadii.topLeft;
|
||||
_contentView.layer.masksToBounds = YES;
|
||||
} else {
|
||||
if (!_borderLayer) {
|
||||
_borderLayer = [[CALayer alloc] init];
|
||||
|
@ -427,8 +425,6 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
|||
layer.borderWidth = 0;
|
||||
layer.borderColor = nil;
|
||||
layer.cornerRadius = 0;
|
||||
_contentView.layer.cornerRadius = 0;
|
||||
_contentView.layer.masksToBounds = NO;
|
||||
|
||||
UIImage *image = RCTGetBorderImage(
|
||||
RCTBorderStyleFromBorderStyle(borderMetrics.borderStyles.left),
|
||||
|
|
Загрузка…
Ссылка в новой задаче