mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
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:
parent
d03d455cc4
commit
ff431734a4
Binary file not shown.
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 153 KiB |
@ -46,7 +46,6 @@ var ViewBorderStyleExample = React.createClass({
|
||||
<View>
|
||||
<View style={{
|
||||
borderWidth: 1,
|
||||
borderRadius: 5,
|
||||
borderStyle: this.state.showBorder ? 'dashed' : null,
|
||||
padding: 5
|
||||
}}>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user