Skip to content
Browse files
Fix border-stroke drawing after resetting border-radius (#28356)
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](

**After the fix:**

![ezgif com-video-to-gif (1)](

Differential Revision: D21124741

Pulled By: shergin

fbshipit-source-id: 2044f8e8ad59a58df42b64d7ee8c4ad1d3b562f1
  • Loading branch information
IjzerenHein authored and facebook-github-bot committed Apr 20, 2020
1 parent 6694ce0 commit 7757ad05762284c059807d7d75fd03559e86f2b2
Showing 1 changed file with 2 additions and 1 deletion.
@@ -998,10 +998,11 @@ private static int fastBorderCompatibleColorOrZero(

private void drawRectangularBackgroundWithBorders(Canvas canvas) {

int useColor = ColorUtil.multiplyColorAlpha(mColor, mAlpha);
if (Color.alpha(useColor) != 0) { // color is not transparent
canvas.drawRect(getBounds(), mPaint);

0 comments on commit 7757ad0

Please sign in to comment.