fix border style without borderRadius

Summary:
closes #6721 closes #3159
before(without borderRadius)
![bug](https://cloud.githubusercontent.com/assets/1488195/14235087/fcf79f8a-f9eb-11e5-9d44-7ab1d131be24.jpg)

after
![fix](https://cloud.githubusercontent.com/assets/1488195/14235067/8cf128b4-f9eb-11e5-8170-ad3a146d6104.jpg)
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:
Sokovikov
2016-04-29 04:52:43 -07:00
committed by Facebook Github Bot 4
parent 8375778496
commit 58876d5a03
2 changed files with 14 additions and 5 deletions

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);
}
/**