Skip to content

Commit

Permalink
Fix dashed/dotted border drawing when border-radius is 0 (#28359)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
IjzerenHein authored and facebook-github-bot committed Aug 16, 2021
1 parent 913448f commit 3e5998e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public ReactViewBackgroundDrawable(Context context) {
@Override
public void draw(Canvas canvas) {
updatePathEffect();
if (!hasRoundedBorders()) {
if (!hasRoundedBorders() && mBorderStyle == BorderStyle.SOLID) {
drawRectangularBackgroundWithBorders(canvas);
} else {
drawRoundedBackgroundWithBorders(canvas);
Expand Down

0 comments on commit 3e5998e

Please sign in to comment.