Fix dashed/dotted border drawing when border-radius is 0 (#28359)

Summary:
This PR fixes the border-style that is not respected when drawing a border with 0 border-radius on Android. This would cause the faster `drawRectangularBackgroundWithBorders` path to be used, but that uses rectangular drawing and doesn't support dashed/dotted stroke patterns.
This PR changes the behavior to use the generic `drawRoundedBackgroundWithBorders` code-path which does support dashed/dotted border-styles.

## Changelog

`[Android] [Fixed] - Fix dashed/dotted border-drawing when border-radius is 0`

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

Test Plan:
**Faulty situation:**

![Screenshot_1584721992](https://user-images.githubusercontent.com/6184593/77184987-e838cd80-6ad0-11ea-9585-058eafbd361a.png)

**After the fix:**

![Screenshot_1584721410](https://user-images.githubusercontent.com/6184593/77184801-9d1eba80-6ad0-11ea-92a7-7212f40ace73.png)

Reviewed By: lunaleaps

Differential Revision: D20590739

Pulled By: charlesbdudley

fbshipit-source-id: 18657ea21e54f763e22c623bf979b3500c1bdcbd
This commit is contained in:
Hein Rutjes
2021-08-16 15:35:37 -07:00
committed by Facebook GitHub Bot
parent 913448f179
commit 3e5998e651
@@ -129,7 +129,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
updatePathEffect();
if (!hasRoundedBorders()) {
if (!hasRoundedBorders() && mBorderStyle == BorderStyle.SOLID) {
drawRectangularBackgroundWithBorders(canvas);
} else {
drawRoundedBackgroundWithBorders(canvas);