diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index a151efb5c..1acb1b2d6 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -494,12 +494,17 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:unused) !RCTRunningInTestEnvironment() && RCTCornerRadiiAreEqual(cornerRadii) && RCTBorderInsetsAreEqual(borderInsets) && - RCTBorderColorsAreEqual(borderColors); + RCTBorderColorsAreEqual(borderColors) && - // TODO: A problem with this is that iOS draws borders in front of the content - // whereas CSS draws them behind the content. Also iOS clips to the outside of - // the border, but CSS clips to the inside. To solve this, we'll need to add - // a container view inside the main view to correctly clip the subviews. + // iOS draws borders in front of the content whereas CSS draws them behind + // the content. For this reason, only use iOS border drawing when clipping + // or when the border is hidden. + + (borderInsets.top == 0 || CGColorGetAlpha(borderColors.top) == 0 || self.clipsToBounds); + + // iOS clips to the outside of the border, but CSS clips to the inside. To + // solve this, we'll need to add a container view inside the main view to + // correctly clip the subviews. if (useIOSBorderRendering) { layer.cornerRadius = cornerRadii.topLeft;