Fix Android border clip check (#37828)

Summary:
Instead of requiring all  types of border color values to be present we should only take into consideration the left, top, right, bottom, and allEdges values and inject block values into  colorBottom and colorTop.

This PR only addresses the first issue described here (https://github.com/facebook/react-native/issues/37753#issuecomment-1587196793) by kelset

## Changelog:

[ANDROID] [FIXED] - Fix border clip check

Pull Request resolved: https://github.com/facebook/react-native/pull/37828

Test Plan:
Test through rn-tester if border color is being applied

<img width="482" alt="image" src="https://github.com/facebook/react-native/assets/11707729/c8c8772c-da8d-4393-bc3f-5868eca5df15">

Reviewed By: lunaleaps

Differential Revision: D46643773

Pulled By: cipolleschi

fbshipit-source-id: efb1ea81bf2462c14767a2554880eb7c44989975
This commit is contained in:
Gabriel Donadel
2023-06-12 10:08:52 -07:00
committed by Facebook GitHub Bot
parent d71da6190a
commit 7d1f7f3f5f
@@ -564,19 +564,28 @@ public class ReactViewBackgroundDrawable extends Drawable {
int colorRight = getBorderColor(Spacing.RIGHT);
int colorBottom = getBorderColor(Spacing.BOTTOM);
int borderColor = getBorderColor(Spacing.ALL);
int colorBlock = getBorderColor(Spacing.BLOCK);
int colorBlockStart = getBorderColor(Spacing.BLOCK_START);
int colorBlockEnd = getBorderColor(Spacing.BLOCK_END);
if (isBorderColorDefined(Spacing.BLOCK)) {
colorBottom = colorBlock;
colorTop = colorBlock;
}
if (isBorderColorDefined(Spacing.BLOCK_END)) {
colorBottom = colorBlockEnd;
}
if (isBorderColorDefined(Spacing.BLOCK_START)) {
colorTop = colorBlockStart;
}
// Clip border ONLY if its color is non transparent
if (Color.alpha(colorLeft) != 0
&& Color.alpha(colorTop) != 0
&& Color.alpha(colorRight) != 0
&& Color.alpha(colorBottom) != 0
&& Color.alpha(borderColor) != 0
&& Color.alpha(colorBlock) != 0
&& Color.alpha(colorBlockStart) != 0
&& Color.alpha(colorBlockEnd) != 0) {
&& Color.alpha(borderColor) != 0) {
mInnerClipTempRectForBorderRadius.top += borderWidth.top;
mInnerClipTempRectForBorderRadius.bottom -= borderWidth.bottom;