Skip to content

Commit 76dcc31

Browse files
committed
fix border style without borderRadius
call drawRoundedBackgroundWithBorders if borderStyle set
1 parent fb6133e commit 76dcc31

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Examples/UIExplorer/ViewExample.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ var ViewBorderStyleExample = React.createClass({
4646
<View>
4747
<View style={{
4848
borderWidth: 1,
49-
borderRadius: 5,
5049
borderStyle: this.state.showBorder ? 'dashed' : null,
5150
padding: 5
5251
}}>

ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ private static enum BorderStyle {
9595

9696
@Override
9797
public void draw(Canvas canvas) {
98-
if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
98+
updatePathEffectForBorderStyle();
99+
if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null ||
100+
!(mBorderStyle == null || mBorderStyle == BorderStyle.SOLID)) {
99101
drawRoundedBackgroundWithBorders(canvas);
100102
} else {
101103
drawRectangularBackgroundWithBorders(canvas);
@@ -298,7 +300,9 @@ private void updatePath() {
298300
bottomLeftRadius + extraRadiusForOutline
299301
},
300302
Path.Direction.CW);
303+
}
301304

305+
private void updatePathEffectForBorderStyle() {
302306
mPathEffectForBorderStyle = mBorderStyle != null
303307
? mBorderStyle.getPathEffect(getFullBorderWidth())
304308
: null;
@@ -332,6 +336,8 @@ private void drawRectangularBackgroundWithBorders(Canvas canvas) {
332336
if (getBorderWidth(Spacing.LEFT) > 0 || getBorderWidth(Spacing.TOP) > 0 ||
333337
getBorderWidth(Spacing.RIGHT) > 0 || getBorderWidth(Spacing.BOTTOM) > 0) {
334338

339+
mPaint.setPathEffect(mPathEffectForBorderStyle);
340+
335341
int borderLeft = getBorderWidth(Spacing.LEFT);
336342
int borderTop = getBorderWidth(Spacing.TOP);
337343
int borderRight = getBorderWidth(Spacing.RIGHT);

0 commit comments

Comments
 (0)