Skip to content

Commit f70c3ca

Browse files
jorge-cabfacebook-github-bot
authored andcommitted
Fix border disappearing when only one edge is transparent (#47940)
Summary: Pull Request resolved: #47940 Fixes #47905 Border was disappearing when only one edge had an alpha of 0. This was due to clipping conditional Changelog: [Internal] Reviewed By: shwanton, NickGerleman Differential Revision: D66397736 fbshipit-source-id: 8937323ad16e0c6e98a55051f244c08ef54c96eb
1 parent 96e66e7 commit f70c3ca

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,10 @@ internal class BorderDrawable(
675675

676676
val borderWidth = computeBorderInsets()
677677

678-
// Clip border ONLY if its color is non transparent
679-
if (Color.alpha(computedBorderColors.left) != 0 &&
680-
Color.alpha(computedBorderColors.top) != 0 &&
681-
Color.alpha(computedBorderColors.right) != 0 &&
678+
// Clip border ONLY if at least one edge is non-transparent
679+
if (Color.alpha(computedBorderColors.left) != 0 ||
680+
Color.alpha(computedBorderColors.top) != 0 ||
681+
Color.alpha(computedBorderColors.right) != 0 ||
682682
Color.alpha(computedBorderColors.bottom) != 0) {
683683
innerClipTempRectForBorderRadius?.top =
684684
innerClipTempRectForBorderRadius?.top?.plus(borderWidth.top) ?: 0f

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,13 @@ private void updatePath() {
646646
colorTop = colorBlockStart;
647647
}
648648

649-
// Clip border ONLY if its color is non transparent
649+
// Clip border ONLY if at least one edge is non-transparent
650650
float pathAdjustment = 0f;
651651
if (Color.alpha(colorLeft) != 0
652-
&& Color.alpha(colorTop) != 0
653-
&& Color.alpha(colorRight) != 0
654-
&& Color.alpha(colorBottom) != 0
655-
&& Color.alpha(borderColor) != 0) {
652+
|| Color.alpha(colorTop) != 0
653+
|| Color.alpha(colorRight) != 0
654+
|| Color.alpha(colorBottom) != 0
655+
|| Color.alpha(borderColor) != 0) {
656656

657657
mInnerClipTempRectForBorderRadius.top += borderWidth.top;
658658
mInnerClipTempRectForBorderRadius.bottom -= borderWidth.bottom;

0 commit comments

Comments
 (0)