mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-30 05:31:01 +00:00
add some android support
add path for Text add stroke pattern add text dashed and fix dasharray bug
This commit is contained in:
@@ -31,13 +31,13 @@ export default function (props) {
|
||||
if (pattern) {
|
||||
clippingProps.clipPath = new SerializablePath(pattern).toJSON();
|
||||
} else {
|
||||
clippingProps = {};
|
||||
// TODO: warn
|
||||
}
|
||||
} else {
|
||||
clippingProps.clipPath = new SerializablePath(clipPath).toJSON();
|
||||
}
|
||||
}
|
||||
|
||||
return clippingProps;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,15 +28,21 @@ function strokeFilter(props, dimensions) {
|
||||
strokeDasharray = strokeDasharray.split(separator).map(dash => +dash);
|
||||
}
|
||||
|
||||
// strokeDasharray length must be more than 1.
|
||||
if (strokeDasharray && strokeDasharray.length === 1) {
|
||||
strokeDasharray.push(strokeDasharray[0]);
|
||||
}
|
||||
|
||||
if (!stroke) {
|
||||
stroke = '#000';
|
||||
}
|
||||
|
||||
|
||||
// TODO: dashoffset
|
||||
// TODO: propTypes check
|
||||
return {
|
||||
stroke: patterns(stroke, +props.strokeOpacity, dimensions, props.svgId),
|
||||
strokeLinecap: caps[props.strokeLinecap] || 2,
|
||||
strokeLinecap: caps[props.strokeLinecap] || 0,
|
||||
strokeLinejoin: joins[props.strokeLinejoin] || 0,
|
||||
strokeDash: strokeDasharray || null,
|
||||
strokeWidth: strokeWidth || 1
|
||||
|
||||
@@ -82,15 +82,12 @@ const alignments = {
|
||||
};
|
||||
|
||||
export default function(props) {
|
||||
let textPath = props.path ? new SerializablePath(props.path).toJSON() : null;
|
||||
var textFrame = extractFontAndLines(
|
||||
props,
|
||||
childrenAsString(props.children)
|
||||
);
|
||||
|
||||
return {
|
||||
alignment: alignments[props.textAnchor] || 0,
|
||||
frame: textFrame,
|
||||
path: textPath
|
||||
frame: extractFontAndLines(
|
||||
props,
|
||||
childrenAsString(props.children)
|
||||
),
|
||||
path: props.path ? new SerializablePath(props.path).toJSON() : undefined
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user