From 3e5998e651eba840603dcb1a9c0be564fc3f868d Mon Sep 17 00:00:00 2001 From: Hein Rutjes Date: Mon, 16 Aug 2021 15:34:19 -0700 Subject: [PATCH] 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 --- .../facebook/react/views/view/ReactViewBackgroundDrawable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java index bed2251c84f..7991ba6a6ed 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java @@ -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);