mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 11:16:06 +08:00
fix border style without borderRadius
Summary: closes #6721 closes #3159 before(without borderRadius)  after  Closes https://github.com/facebook/react-native/pull/6789 Differential Revision: D3240657 Pulled By: mkonicek fb-gh-sync-id: 4eb8f72d7278d880297fb73653ef530719af3d5b fbshipit-source-id: 4eb8f72d7278d880297fb73653ef530719af3d5b
This commit is contained in:
committed by
Facebook Github Bot 4
parent
8375778496
commit
58876d5a03
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user