import React from 'react'; import createReactNativeComponentClass from 'react-native/Libraries/Renderer/shims/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'; const idExpReg = /^#(.+)$/; export default class extends Shape { static displayName = 'Span'; static propTypes = textPathProps; render() { let {children, href, startOffset, method, spacing, side, ...props} = this.props; if (href) { let matched = href.match(idExpReg); if (matched) { href = matched[1]; startOffset = `${startOffset || 0}`; return ; } } console.warn('Invalid `href` prop for `TextPath` element, expected a href like `"#id"`, but got: "' + props.href + '"'); return {children}; } } const RNSVGTextPath = createReactNativeComponentClass({ validAttributes: TextPathAttributes, uiViewClassName: 'RNSVGTextPath' });