diff --git a/Examples/UIExplorer/ViewExample.js b/Examples/UIExplorer/ViewExample.js index 4be867b27bc5ce..c5cb7cae73b7d3 100644 --- a/Examples/UIExplorer/ViewExample.js +++ b/Examples/UIExplorer/ViewExample.js @@ -46,7 +46,6 @@ var ViewBorderStyleExample = React.createClass({ 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 fd8961cb8628b6..7aef44b1b4096b 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 @@ -95,10 +95,14 @@ private static enum BorderStyle { @Override public void draw(Canvas canvas) { - if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) { - drawRoundedBackgroundWithBorders(canvas); - } else { + updatePathEffect(); + boolean roundedBorders = mBorderCornerRadii != null || + (!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0); + + if ((mBorderStyle == null || mBorderStyle == BorderStyle.SOLID) && !roundedBorders) { drawRectangularBackgroundWithBorders(canvas); + } else { + drawRoundedBackgroundWithBorders(canvas); } } @@ -231,7 +235,6 @@ private void drawRoundedBackgroundWithBorders(Canvas canvas) { mPaint.setColor(ColorUtil.multiplyColorAlpha(borderColor, mAlpha)); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(fullBorderWidth); - mPaint.setPathEffect(mPathEffectForBorderStyle); canvas.drawPath(mPathForBorderRadius, mPaint); } } @@ -298,10 +301,17 @@ private void updatePath() { bottomLeftRadius + extraRadiusForOutline }, Path.Direction.CW); + } + /** + * Set type of border + */ + private void updatePathEffect() { mPathEffectForBorderStyle = mBorderStyle != null ? mBorderStyle.getPathEffect(getFullBorderWidth()) : null; + + mPaint.setPathEffect(mPathEffectForBorderStyle); } /**