Skip to content

Commit 7757ad0

Browse files
IjzerenHeinfacebook-github-bot
authored andcommitted
Fix border-stroke drawing after resetting border-radius (#28356)
Summary: This PR fixes incorrect drawing of the View borders on Android, after changing the border-radius back to 0 *(and when no background-color is defined)*. This happens because the `drawRoundedBackgroundWithBorders` function in ReactViewBackgroundDrawable changes the style on the Paint object to `STROKE`. This style is however never reverted back to `FILL`. This change ensures that the Paint style is set to `FILL` for the full execution of the `drawRectangularBackgroundWithBorders` function. ## Changelog `[Android] [Fixed] - Fix border-drawing when changing border-radius back to 0` Pull Request resolved: #28356 Test Plan: **Faulty situation:** ![ezgif com-video-to-gif](https://user-images.githubusercontent.com/6184593/77153163-9759b280-6a99-11ea-82bb-33a1e0a4934c.gif) **After the fix:** ![ezgif com-video-to-gif (1)](https://user-images.githubusercontent.com/6184593/77153825-c91f4900-6a9a-11ea-8e0c-a4280b9e72b8.gif) Differential Revision: D21124741 Pulled By: shergin fbshipit-source-id: 2044f8e8ad59a58df42b64d7ee8c4ad1d3b562f1
1 parent 6694ce0 commit 7757ad0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,11 @@ private static int fastBorderCompatibleColorOrZero(
998998
}
999999

10001000
private void drawRectangularBackgroundWithBorders(Canvas canvas) {
1001+
mPaint.setStyle(Paint.Style.FILL);
1002+
10011003
int useColor = ColorUtil.multiplyColorAlpha(mColor, mAlpha);
10021004
if (Color.alpha(useColor) != 0) { // color is not transparent
10031005
mPaint.setColor(useColor);
1004-
mPaint.setStyle(Paint.Style.FILL);
10051006
canvas.drawRect(getBounds(), mPaint);
10061007
}
10071008

0 commit comments

Comments
 (0)