Revert "Revert "fix border style without borderRadius""

Summary: Closes https://github.com/facebook/react-native/pull/7389

Differential Revision: D3269828

Pulled By: mkonicek

fb-gh-sync-id: 896789fcc76953a035cf8701d3a90211b92b6b80
fbshipit-source-id: 896789fcc76953a035cf8701d3a90211b92b6b80
This commit is contained in:
Sokovikov 2016-05-06 09:22:12 -07:00 committed by Facebook Github Bot 8
parent d03d455cc4
commit ff431734a4
3 changed files with 14 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 153 KiB

View File

@ -46,7 +46,6 @@ var ViewBorderStyleExample = React.createClass({
<View>
<View style={{
borderWidth: 1,
borderRadius: 5,
borderStyle: this.state.showBorder ? 'dashed' : null,
padding: 5
}}>

View File

@ -95,10 +95,14 @@ import com.facebook.csslayout.Spacing;
@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 @@ import com.facebook.csslayout.Spacing;
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 @@ import com.facebook.csslayout.Spacing;
bottomLeftRadius + extraRadiusForOutline
},
Path.Direction.CW);
}
/**
* Set type of border
*/
private void updatePathEffect() {
mPathEffectForBorderStyle = mBorderStyle != null
? mBorderStyle.getPathEffect(getFullBorderWidth())
: null;
mPaint.setPathEffect(mPathEffectForBorderStyle);
}
/**