mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 05:55:10 +00:00
strokeDash => strokeDasharray
This commit is contained in:
@@ -51,7 +51,7 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
|||||||
protected @Nullable Path mPath;
|
protected @Nullable Path mPath;
|
||||||
private @Nullable float[] mStrokeColor;
|
private @Nullable float[] mStrokeColor;
|
||||||
private @Nullable float[] mFillColor;
|
private @Nullable float[] mFillColor;
|
||||||
private @Nullable float[] mStrokeDash;
|
private @Nullable float[] mStrokeDasharray;
|
||||||
private float mStrokeWidth = 1;
|
private float mStrokeWidth = 1;
|
||||||
private float mStrokeDashoffset = 0;
|
private float mStrokeDashoffset = 0;
|
||||||
private int mStrokeLinecap = CAP_ROUND;
|
private int mStrokeLinecap = CAP_ROUND;
|
||||||
@@ -85,9 +85,9 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
|||||||
markUpdated();
|
markUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactProp(name = "strokeDash")
|
@ReactProp(name = "strokeDasharray")
|
||||||
public void setStrokeDash(@Nullable ReadableArray strokeDash) {
|
public void setStrokeDash(@Nullable ReadableArray strokeDasharray) {
|
||||||
mStrokeDash = PropHelper.toFloatArray(strokeDash);
|
mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray);
|
||||||
markUpdated();
|
markUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,8 +229,8 @@ public class RNSVGPathShadowNode extends RNSVGVirtualNode {
|
|||||||
|
|
||||||
setupPaint(paint, opacity, mStrokeColor);
|
setupPaint(paint, opacity, mStrokeColor);
|
||||||
|
|
||||||
if (mStrokeDash != null && mStrokeDash.length > 0) {
|
if (mStrokeDasharray != null && mStrokeDasharray.length > 0) {
|
||||||
paint.setPathEffect(new DashPathEffect(mStrokeDash, mStrokeDashoffset));
|
paint.setPathEffect(new DashPathEffect(mStrokeDasharray, mStrokeDashoffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
@property (nonatomic, assign) CGFloat strokeWidth;
|
@property (nonatomic, assign) CGFloat strokeWidth;
|
||||||
@property (nonatomic, assign) CGLineCap strokeLinecap;
|
@property (nonatomic, assign) CGLineCap strokeLinecap;
|
||||||
@property (nonatomic, assign) CGLineJoin strokeLinejoin;
|
@property (nonatomic, assign) CGLineJoin strokeLinejoin;
|
||||||
@property (nonatomic, assign) RNSVGCGFloatArray strokeDash;
|
@property (nonatomic, assign) RNSVGCGFloatArray strokeDasharray;
|
||||||
@property (nonatomic, assign) CGFloat strokeDashoffset;
|
@property (nonatomic, assign) CGFloat strokeDashoffset;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -40,16 +40,16 @@
|
|||||||
_strokeLinejoin = strokeLinejoin;
|
_strokeLinejoin = strokeLinejoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStrokeDash:(RNSVGCGFloatArray)strokeDash
|
- (void)setStrokeDash:(RNSVGCGFloatArray)strokeDasharray
|
||||||
{
|
{
|
||||||
if (strokeDash.array == _strokeDash.array) {
|
if (strokeDasharray.array == _strokeDasharray.array) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_strokeDash.array) {
|
if (_strokeDasharray.array) {
|
||||||
free(_strokeDash.array);
|
free(_strokeDasharray.array);
|
||||||
}
|
}
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
_strokeDash = strokeDash;
|
_strokeDasharray = strokeDasharray;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStrokeDashoffset:(CGFloat)strokeDashoffset
|
- (void)setStrokeDashoffset:(CGFloat)strokeDashoffset
|
||||||
@@ -60,8 +60,8 @@
|
|||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if (_strokeDash.array) {
|
if (_strokeDasharray.array) {
|
||||||
free(_strokeDash.array);
|
free(_strokeDasharray.array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ RCT_EXPORT_VIEW_PROPERTY(strokeLinecap, CGLineCap)
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(strokeLinejoin, CGLineJoin)
|
RCT_EXPORT_VIEW_PROPERTY(strokeLinejoin, CGLineJoin)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(clipPath, CGPath)
|
RCT_EXPORT_VIEW_PROPERTY(clipPath, CGPath)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(clipRule, RNSVGCGFCRule)
|
RCT_EXPORT_VIEW_PROPERTY(clipRule, RNSVGCGFCRule)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(strokeDash, RNSVGCGFloatArray)
|
RCT_EXPORT_VIEW_PROPERTY(strokeDasharray, RNSVGCGFloatArray)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(strokeDashoffset, CGFloat)
|
RCT_EXPORT_VIEW_PROPERTY(strokeDashoffset, CGFloat)
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ var RenderableAttributes = Object.assign({
|
|||||||
strokeLinecap: true,
|
strokeLinecap: true,
|
||||||
strokeLinejoin: true,
|
strokeLinejoin: true,
|
||||||
fillRule: true,
|
fillRule: true,
|
||||||
strokeDash: {
|
strokeDasharray: {
|
||||||
diff: arrayDiffer
|
diff: arrayDiffer
|
||||||
},
|
},
|
||||||
strokeDashoffset: true
|
strokeDashoffset: true
|
||||||
|
|||||||
@@ -38,13 +38,12 @@ function strokeFilter(props, dimensions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: dashoffset
|
|
||||||
// TODO: propTypes check
|
// TODO: propTypes check
|
||||||
return {
|
return {
|
||||||
stroke: patterns(stroke, +props.strokeOpacity, dimensions, props.svgId),
|
stroke: patterns(stroke, +props.strokeOpacity, dimensions, props.svgId),
|
||||||
strokeLinecap: caps[props.strokeLinecap] || 0,
|
strokeLinecap: caps[props.strokeLinecap] || 0,
|
||||||
strokeLinejoin: joins[props.strokeLinejoin] || 0,
|
strokeLinejoin: joins[props.strokeLinejoin] || 0,
|
||||||
strokeDash: strokeDasharray || null,
|
strokeDasharray: strokeDasharray || null,
|
||||||
strokeWidth: strokeWidth || 1,
|
strokeWidth: strokeWidth || 1,
|
||||||
strokeDashoffset: strokeDasharray ? (+props.strokeDashoffset || 0) : null
|
strokeDashoffset: strokeDasharray ? (+props.strokeDashoffset || 0) : null
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user