mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-28 04:55:12 +00:00
Remove internal imports. Run prettier.
This commit is contained in:
+55
-27
@@ -1,49 +1,77 @@
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
import createReactNativeComponentClass from '../lib/createReactNativeComponentClass';
|
||||
import {TextPathAttributes} from '../lib/attributes';
|
||||
import extractText from '../lib/extract/extractText';
|
||||
import Shape from './Shape';
|
||||
import {textPathProps} from '../lib/props';
|
||||
import extractProps from '../lib/extract/extractProps';
|
||||
import TSpan from './TSpan';
|
||||
import { requireNativeComponent } from "react-native";
|
||||
import { TextPathAttributes } from "../lib/attributes";
|
||||
import extractText from "../lib/extract/extractText";
|
||||
import Shape from "./Shape";
|
||||
import { textPathProps } from "../lib/props";
|
||||
import extractProps from "../lib/extract/extractProps";
|
||||
import TSpan from "./TSpan";
|
||||
|
||||
const idExpReg = /^#(.+)$/;
|
||||
|
||||
export default class extends Shape {
|
||||
static displayName = 'Span';
|
||||
static displayName = "TextPath";
|
||||
|
||||
static propTypes = textPathProps;
|
||||
|
||||
render() {
|
||||
let {children, href, startOffset, method, spacing, side, alignmentBaseline, midLine, ...props} = this.props;
|
||||
let {
|
||||
children,
|
||||
href,
|
||||
startOffset,
|
||||
method,
|
||||
spacing,
|
||||
side,
|
||||
alignmentBaseline,
|
||||
midLine,
|
||||
...props
|
||||
} = this.props;
|
||||
if (href) {
|
||||
let matched = href.match(idExpReg);
|
||||
|
||||
if (matched) {
|
||||
href = matched[1];
|
||||
startOffset = `${startOffset || 0}`;
|
||||
return <RNSVGTextPath
|
||||
{...{href, startOffset, method, spacing, side, alignmentBaseline, midLine}}
|
||||
{...extractProps({
|
||||
...props,
|
||||
x: null,
|
||||
y: null,
|
||||
}, this)}
|
||||
{...extractText({
|
||||
children,
|
||||
}, true)}
|
||||
/>;
|
||||
return (
|
||||
<RNSVGTextPath
|
||||
{...{
|
||||
href,
|
||||
startOffset,
|
||||
method,
|
||||
spacing,
|
||||
side,
|
||||
alignmentBaseline,
|
||||
midLine
|
||||
}}
|
||||
{...extractProps(
|
||||
{
|
||||
...props,
|
||||
x: null,
|
||||
y: null
|
||||
},
|
||||
this
|
||||
)}
|
||||
{...extractText(
|
||||
{
|
||||
children
|
||||
},
|
||||
true
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.warn('Invalid `href` prop for `TextPath` element, expected a href like `"#id"`, but got: "' + props.href + '"');
|
||||
console.warn(
|
||||
'Invalid `href` prop for `TextPath` element, expected a href like `"#id"`, but got: "' +
|
||||
props.href +
|
||||
'"'
|
||||
);
|
||||
return <TSpan>{children}</TSpan>;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const RNSVGTextPath = createReactNativeComponentClass('RNSVGTextPath', () => ({
|
||||
validAttributes: TextPathAttributes,
|
||||
uiViewClassName: 'RNSVGTextPath'
|
||||
}));
|
||||
const RNSVGTextPath = requireNativeComponent("RNSVGTextPath", null, {
|
||||
nativeOnly: TextPathAttributes
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user