Skip to content

Commit 0c590b3

Browse files
bestanderFacebook Github Bot 5
authored andcommitted
Revert "fix border style without borderRadius"
Summary: Subj broke ObjC snapshot tests This reverts commit 58876d5. Closes #7303 Differential Revision: D3243670 fb-gh-sync-id: acef6bc7a50b0fa7dc112b88407644e8226d6f85 fbshipit-source-id: acef6bc7a50b0fa7dc112b88407644e8226d6f85
1 parent 169cfb5 commit 0c590b3

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

Examples/UIExplorer/ViewExample.js

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

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,10 @@ private static enum BorderStyle {
9595

9696
@Override
9797
public void draw(Canvas canvas) {
98-
updatePathEffect();
99-
boolean roundedBorders = mBorderCornerRadii != null ||
100-
(!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0);
101-
102-
if ((mBorderStyle == null || mBorderStyle == BorderStyle.SOLID) && !roundedBorders) {
103-
drawRectangularBackgroundWithBorders(canvas);
104-
} else {
98+
if ((!CSSConstants.isUndefined(mBorderRadius) && mBorderRadius > 0) || mBorderCornerRadii != null) {
10599
drawRoundedBackgroundWithBorders(canvas);
100+
} else {
101+
drawRectangularBackgroundWithBorders(canvas);
106102
}
107103
}
108104

@@ -235,6 +231,7 @@ private void drawRoundedBackgroundWithBorders(Canvas canvas) {
235231
mPaint.setColor(ColorUtil.multiplyColorAlpha(borderColor, mAlpha));
236232
mPaint.setStyle(Paint.Style.STROKE);
237233
mPaint.setStrokeWidth(fullBorderWidth);
234+
mPaint.setPathEffect(mPathEffectForBorderStyle);
238235
canvas.drawPath(mPathForBorderRadius, mPaint);
239236
}
240237
}
@@ -301,17 +298,10 @@ private void updatePath() {
301298
bottomLeftRadius + extraRadiusForOutline
302299
},
303300
Path.Direction.CW);
304-
}
305301

306-
/**
307-
* Set type of border
308-
*/
309-
private void updatePathEffect() {
310302
mPathEffectForBorderStyle = mBorderStyle != null
311303
? mBorderStyle.getPathEffect(getFullBorderWidth())
312304
: null;
313-
314-
mPaint.setPathEffect(mPathEffectForBorderStyle);
315305
}
316306

317307
/**

0 commit comments

Comments
 (0)